Is it normal or a bug that same query has the result with different score?


I'm working on a project using elk search. I need consistant score of query result for the purpose of consistant search_after result. However, the score is not consistant given the same query, same index, no change to the index.

Have u came across the same issue?

I'm wondering:

  1. Is the score inherently inconsistant for elk? or is this some bug?
  2. Is just the absolute score inconsistant? what about the relative score? I mean the ranking/sorting of all query hits would be consistant or inconsistant?

Notes: The score is generated by a sole match_phrase clause and the version is 8.16.1. This database does not have writing for a while.

What do you see in explain mode? It may be useful to compare it side-by-side when final scores are different

POST _search?explain=true
{
  "query": {
<...>
  }
}
1 Like

Thank u for the suggestion, it's helpful!

I used the explain mode and compare, it looks tf/idf calculation uses different ifd statistics, not sure if it is because different shards responded to the search (we have one primary and one secondary)

Does any one know the source of inconsistency?

FYI, the structure of my elk structure is: 3 cluster, 12 shards, each shard has two copies.

I look at one particular result and this result resides in one shard (one primary and one secondary) exactly

Yes. That's most likely the case here.

What happens if you are using dfs_query_then_fetch for search_type? See Search API | Elasticsearch Guide [8.17] | Elastic

1 Like