Elasticsearch 2.2 does not take “boost” into account


(christoph hammer) #1

I have a problem with elastic search 2.2:

have the following search query:

{
 "query": {
"indices": {
  "index": "my_index",
  "query": {
    "dis_max": {
      "tie_breaker": 0,
      "boost": 2,
      "queries": [
        {
          "function_score": {
            "query": {
              "query_string": {
                "fields": [
                  "searchName"
                ],
                "query": "\"sala\"",
                "use_dis_max": false,
                "boost": 10
              }
            },
            "field_value_factor": {
              "field": "rank",
              "factor": 11,
              "modifier": "log1p"
            },
            "boost_mode": "sum",
            "boost": 20
          }
        }
      ]
    }
  },
  "no_match_query": "none"
 }
},
  "size": 1
}

Running the query on Elasticsearch 2.1 and 2.2, "explain" returns the following result:

As you can see, the field used for the factor is 0 in both cases, but
in ES2.1, the score of the document is 227.97464 (which is correct) and
in ES2.2 it is 5.743438.

In ES2.1, the outermost calculation contains a "function score,
product of:" of the boost (40 = 20 * 2) and the calculated score of
5.699366.

In ES2.2, this step is missing and therefore the result is just
5.743438. The small difference of 5.699366 to 5.743438 is probably ok,
because there is a slightly different number of documents in the index.
However, in ES2.2, the boost should obviously still be taken in account.

Now my question is: Am I doing something wrong (and if yes: what?) or
is there really a bug in the calculation of the score in Elasticsearch
2.2?


(system) #2