Elasticsearch function_score does not explain the result

I am trying to get function_score to work, but it seems to be ignored. Here is my request:

{
  "explain" : true,
  "query": {
    "function_score": {
      "functions": [
        {
          "script_score": {
            "script": "_score * 999 * doc['total_digital_items_sold'].value"
          }
        }
      ],
      "query": {
        "filtered": {
          "query": {
             "query_string": {
               "query": "photo",
                 "fields": [ "title^3" ],
                 "use_dis_max": true,
                 "analyzer": "snowball"
               }
             },
             "filter": { "and": [ { } ] }
          }
        }
      }
    }
  }
}

This does not seem to affect the results and does not appear in the explanation. Any ideas on what I'm doing wrong?

+4
source share

Source: https://habr.com/ru/post/1534732/


All Articles