# Multiple scripts within script\_score

**URL:** https://discuss.elastic.co/t/multiple-scripts-within-script-score/203698
**Category:** Elasticsearch
**Created:** [October 15, 2019, 5:53pm UTC](https://discuss.elastic.co/t/multiple-scripts-within-script-score/203698 "2019-10-15T17:53:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sgTextSearch](https://avatars.discourse-cdn.com/v4/letter/s/e79b87/32.png) [@sgTextSearch](https://discuss.elastic.co/u/sgTextSearch)
#### Post date: [October 15, 2019, 5:53pm UTC](https://discuss.elastic.co/t/multiple-scripts-within-script-score/203698/1 "2019-10-15T17:53:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)
#### Post date: [October 16, 2019, 2:33am UTC](https://discuss.elastic.co/t/multiple-scripts-within-script-score/203698/2 "2019-10-16T02:33:31Z")

</div>

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](https://github.com/elastic/elasticsearch/issues/42811#issuecomment-524854701) that will allow to flexibly combine score from other queries.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 13, 2019, 2:33am UTC](https://discuss.elastic.co/t/multiple-scripts-within-script-score/203698/3 "2019-11-13T02:33:31Z")

</div>

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