# Elasticsearch scoring Issue for same data

**URL:** <https://discuss.elastic.co/t/elasticsearch-scoring-issue-for-same-data/299690>\
**Category:** Elasticsearch\
**Tags:** kql-kibana-query-language, eql-elastic-query-language\
**Created:** [March 15, 2022, 7:05am UTC](https://discuss.elastic.co/t/elasticsearch-scoring-issue-for-same-data/299690 "2022-03-15T07:05:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![painless\_elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/painless_elastic/32/94652_2.png) [@painless\_elastic](https://discuss.elastic.co/u/painless_elastic)\
**Post date:** [March 15, 2022, 7:05am UTC](https://discuss.elastic.co/t/elasticsearch-scoring-issue-for-same-data/299690/1 "2022-03-15T07:05:41Z")

</div>

I have an Elastic Index with the below 4 documents.

```auto
PUT test/_doc/1
{
"tag" : "prove"
}
PUT test/_doc/2
{
"tag" : "prove"
}
PUT test/_doc/3
{
"tag" : "freckle"
}
PUT test/_doc/4
{
"tag" : "freckle"
}

```

On this i am running a simple query to pick the documents, with tag either prove or freckle. As one can infer all four will come in the results.

Query-

```auto
GET test/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "tag": "prove freckle"
          }
        }
      ]
    }
  }
}

```

Result -

```auto
{
  "took" : 950,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 4,
      "relation" : "eq"
    },
    "max_score" : 0.87546873,
    "hits" : [
      {
        "_index" : "test",
        "_type" : "_doc",
        "_id" : "3",
        "_score" : 0.87546873,
        "_source" : {
          "tag" : "freckle"
        }
      },
      {
        "_index" : "test",
        "_type" : "_doc",
        "_id" : "4",
        "_score" : 0.87546873,
        "_source" : {
          "tag" : "freckle"
        }
      },
      {
        "_index" : "test",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 0.53899646,
        "_source" : {
          "tag" : "prove"
        }
      },
      {
        "_index" : "test",
        "_type" : "_doc",
        "_id" : "2",
        "_score" : 0.53899646,
        "_source" : {
          "tag" : "prove"
        }
      }
    ]
  }
}

```

I am unable to understand how elastic is giving different scores to docs, although all documents match the query and all are in the same shard. No one has other fields, and all docs are equally unique, then how come such variation in result??  
Why freckle tag doc is gaining more scores than prove?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 15, 2022, 8:26am UTC](https://discuss.elastic.co/t/elasticsearch-scoring-issue-for-same-data/299690/2 "2022-03-15T08:26:53Z")

</div>

The length of a term also plays a role.

You can add the `"explain": true` option to see how it's computed.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 15, 2022, 9:01am UTC](https://discuss.elastic.co/t/elasticsearch-scoring-issue-for-same-data/299690/3 "2022-03-15T09:01:56Z")

</div>

If you have any deleted documents the words they used can still contribute to scores on surviving docs that are searched using these same terms.  
The popularity count for a term can include deleted docs until they are eventually merged away.

---

<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:** [April 12, 2022, 9:02am UTC](https://discuss.elastic.co/t/elasticsearch-scoring-issue-for-same-data/299690/4 "2022-04-12T09:02:34Z")

</div>

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