Inconsistent scores between versions

The scores between Elasticsearch 2.x and 5.x seem to be different for the same indexed data with the same mapping and same query.

Using:

PUT test
{
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "type1" : {
            "properties" : {
                "field1" : { "type" : "string" }
            }
        }
    }
}

PUT /test/type1/1
{
  "field1": "My first blog entry"
}

POST test/_search
{
    "query": {
        "match" : {
            "field1" : "blog"
        }
    }
} 

The results on 2.4.3 are

{
   "took": 1,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 1,
      "max_score": 0.2876821,
      "hits": [
         {
            "_index": "test",
            "_type": "type1",
            "_id": "1",
            "_score": 0.2876821,
            "_source": {
               "field1": "My first blog entry"
            }
         }
      ]
   }
}

The results on 5.1.1 are

   {
       "took": 1,
       "timed_out": false,
       "_shards": {
          "total": 1,
          "successful": 1,
          "failed": 0
       },
       "hits": {
          "total": 1,
          "max_score": 0.15342641,
          "hits": [
             {
                "_index": "test",
                "_type": "type1",
                "_id": "1",
                "_score": 0.15342641,
                "_source": {
                   "field1": "My first blog entry"
                }
             }
          ]
       }
    }

Is this the expected behavior?
And wouldn't a different scoring algorithm have unexpected results when using queries with boosts made in 2.x?

This is expected.

Lucene 6 / Elasticsearch 5 default ranking function switched from TF/IDF to Okapi BM25 https://en.wikipedia.org/wiki/Okapi_BM25

The "natural boosting" of TF/IDF because of different field lengths disappears with BM25, but explicit boosting on query terms should behave the same.

https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html

1 Like

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