elasticsearch如何根据自定义数组排序?

现在有一个id数组顺序为[5, 6, 8, 10, 1]

如何实现像mysql一样根据给出的id数组对ES返回值进行自定义排序?

function score类似于这样

{
  "query": {
    "function_score": {
      "query": {
        "match_all": {}
      },
      "functions": [
          {
            "filter": { 
                "term": {"ID": "5"}
            },
            "weight": 10
          },
          {
            "filter": { 
                "term": {"ID": "6"}
            },
            "weight": 9
          },
          {
            "filter": { 
                "term": {"ID": "8"}
            },
            "weight": 8
          }
      ],
      "score_mode":"max",
       "boost_mode":"multiply"
    }
  }
}