Searching in same condition but different scoring

I use ES5.1.1
query is as below

index/type/_search
{ 
  "query": {
    "term": {
      "status": "ZA"
    }
  }
}

Conditions
all data have status field.
ZA is full match value.

result by explain API

{
  "_index": "index",
  "_type": "type",
  "_id": "1010999",
  "matched": true,
  "explanation": {
    "value": 6.4028416,
    "description": "sum of:",
    "details": [
      {
        "value": 6.4028416,
        "description": "weight(status:ZA in 0) [PerFieldSimilarity], result of:",    ----(status:ZA in 0) is different from the other result.
        "details": [
          {
            "value": 6.4028416,
            "description": "score(doc=0,freq=1.0 = termFreq=1.0\n), product of:",
            "details": [
              {
                "value": 6.4028416,
                "description": "idf(docFreq=151, docCount=91438)",
                "details": []
              },
              {
                "value": 1,
                "description": "tfNorm, computed from:",
                "details": [
                  {
                    "value": 1,
                    "description": "termFreq=1.0",
                    "details": []
                  },
                  {
                    "value": 1.2,
                    "description": "parameter k1",
                    "details": []
                  },
                  {
                    "value": 0,
                    "description": "parameter b (norms omitted for field)",
                    "details": []
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "value": 0,
        "description": "match on required clause, product of:",
        "details": [
          {
            "value": 0,
            "description": "# clause",
            "details": []
          },
          {
            "value": 1,
            "description": "*:*, product of:",
            "details": [
              {
                "value": 1,
                "description": "boost",
                "details": []
              },
              {
                "value": 1,
                "description": "queryNorm",
                "details": []
              }
            ]
          }
        ]
      }
    ]
  }
}
{
  "_index": "index",
  "_type": "type",
  "_id": "1112675",
  "matched": true,
  "explanation": {
    "value": 6.345958,
    "description": "sum of:",
    "details": [
      {
        "value": 6.345958,
        "description": "weight(status:ZA in 10849) [PerFieldSimilarity], result of:",      ----(status:ZA in 10849) part is different from the other result.
        "details": [
          {
            "value": 6.345958,
            "description": "score(doc=10849,freq=1.0 = termFreq=1.0\n), product of:",
            "details": [
              {
                "value": 6.345958,
                "description": "idf(docFreq=163, docCount=93224)",
                "details": []
              },
              {
                "value": 1,
                "description": "tfNorm, computed from:",
                "details": [
                  {
                    "value": 1,
                    "description": "termFreq=1.0",
                    "details": []
                  },
                  {
                    "value": 1.2,
                    "description": "parameter k1",
                    "details": []
                  },
                  {
                    "value": 0,
                    "description": "parameter b (norms omitted for field)",
                    "details": []
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "value": 0,
        "description": "match on required clause, product of:",
        "details": [
          {
            "value": 0,
            "description": "# clause",
            "details": []
          },
          {
            "value": 1,
            "description": "*:*, product of:",
            "details": [
              {
                "value": 1,
                "description": "boost",
                "details": []
              },
              {
                "value": 1,
                "description": "queryNorm",
                "details": []
              }
            ]
          }
        ]
      }
    ]
  }
}

Result scores are different.
Is there any reason that scores are different?

Any tips??

My guess is that the documents reside in different shards and therefore
have different IDF values for the same term. Try using dfs-query-then-fetch
to see if that changes anything.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-search-type.html#dfs-query-then-fetch

1 Like

Thank you for reply.

It helped me a lot to understand why score was different.

I found this article as well.
To help someone who gets same issue, here is the answer as well.

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