Primary vs replica inconsistency in ES5.6


I recently noticed that some of our queries returned inconsistent results, digging deep, I found that the query returned 0 results when the query was executed against one replica and returned results when executed against the other copies (we have 3 copies in total). I used the search API with preference=_only_nodes:<node> to deduce the above.

When I tried to use the explain API with _source=true and see what the response is, it looks like the document is present in all the replicas, but the output of the explain API returns matched:false against one copy and returns matched:true against another copies. The actual search query used is a multi_match query.
Why would this happen? Is this a known issue/bug in Elasticsearch?

I noticed that ES 5.6 had some issues where docs are missing in replica, is it related to the same?

Elasticsearch version: 5.6

5.X is EOL, please upgrade ASAP :slight_smile:

How new is this data, i.e. just indexed a few seconds ago or much older, as certainly should be in sync if all the shards are refreshed, but they are not totally sync'd in the refresh period and in some other cases when there is limited indexing going on (refresh gets delayed).

Can you find the doc ID and query by that, as that's more accurate than any text or normal search?

As mentioned, it's an old version so hard to get help.

This data isn't newly indexed. It hasn't been updated for more than a month. I was able to find the doc by id in all replicas. The phrase_prefix match with max_expansions is the query that is not returning correct values. When I increased max_expansions to 100, instead of the default 50, all the replicas consistently returned the result. Is this the kind of inconsistency expected across different replicas?

Updating the ES version - yes, we are planning to do that! But more concretely, is the above issue a known bug in 5.x and is fixed in later versions or is this something expected to happen with these shape of queries irrespective of the ES version?

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