# Inconsistent scores between versions

**URL:** <https://discuss.elastic.co/t/inconsistent-scores-between-versions/71147>\
**Category:** Elasticsearch\
**Created:** [January 10, 2017, 8:06pm UTC](https://discuss.elastic.co/t/inconsistent-scores-between-versions/71147 "2017-01-10T20:06:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brian/32/54874_2.png) [@brian](https://discuss.elastic.co/u/brian)\
**Post date:** [January 10, 2017, 8:06pm UTC](https://discuss.elastic.co/t/inconsistent-scores-between-versions/71147/1 "2017-01-10T20:06:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [January 10, 2017, 10:32pm UTC](https://discuss.elastic.co/t/inconsistent-scores-between-versions/71147/2 "2017-01-10T22:32:13Z")

</div>

This is expected.

Lucene 6 / Elasticsearch 5 default ranking function switched from TF/IDF to Okapi BM25 [https://en.wikipedia.org/wiki/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](https://www.elastic.co/guide/en/elasticsearch/guide/current/pluggable-similarites.html)

---

<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:** [February 7, 2017, 10:32pm UTC](https://discuss.elastic.co/t/inconsistent-scores-between-versions/71147/3 "2017-02-07T22:32:30Z")

</div>

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