Multiple scripts within script_score

How can I use multiple scripts within script_score query in 7.4? I need to apply a filter on the result set and then define corresponding scripts.

The function_score query currently being used has the following format:

POST index1, index2, index3/_seacrh
{
  "query": {
    "function_score": {
      "query": {},
      "functions": [
        {
          "filter": {},
          "script_score": {
            "script": {
              "source": "",
              "lang": "painless"
            }
          }
        },
        {
          "filter": {},
          "script_score": {
            "script": {
              "source": "",
              "lang": "painless"
            }
          }
        }
      ],
      "score_mode": "sum",
      "boost_mode": "sum",
      "boost": 1
    }
  }
}

I am trying to replace the function score query with script_score.

Hello,
There is no way to use multiple scripts within script_score query. This is the only functionality that is missing, and doesn't allow us to deprecate function_score query yet.

We are discussing a possibility to introduce a new type of query that will allow to flexibly combine score from other queries.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.