I came across a strange issue with our elastic search index, where the same query with particular sorting returns different results. My index is on 4 shards and also in the mapping I have specified "_routing": { "required": true }. In the query I pass _routing as one of the terms { "term": { "_routing": xxx } }".
I came over this https://www.elastic.co/guide/en/elasticsearch/guide/current/relevance-is-broken.html, and if understand correctly this documentation basically states that I can see this behavior because of relevance being calculated on different shards differently just because of the number of documents on each shard.
Also, after readings this https://www.elastic.co/guide/en/elasticsearch/guide/current/routing-value.html, I believed that specifying _routing will route my document into one shard based on the value.
So my questions are:
- Why specifying ?search_type=dfs_query_then_fetch does not seem to change the behavior? I still see two different results for different requests.
- When I specify _routing value, all the documents in theory with the same _routing value supposed to come from the same shard? But why is the relevance still broken and I see different results every time I ran the query? It feels like documents with the same _routing can go to multiple shards, can this be true?
I see two different types of results. I have the index on 4 shards, 2 primary and 2 secondary.