kyleqian
kyleqian

Reputation: 385

Why elasticsearch return docs in different order with the same query?

In elasticsearch 7.9, I have an Index with 1 shard and 1 replica. I use simple datetime filter to get docs between start time and end time, but I often get same result set in different order. I do not want to use Sort clause and compute scores. I just want to get results in same order. So there is anyway to do this without using Sort?

Upvotes: 0

Views: 1078

Answers (1)

Amit
Amit

Reputation: 32376

It may be happening due to the fact, that you have 1 replica for your index, which might have some difference or different values for your timestamp field, you can use the preference param and make sure, your search results are always returned from the same shard.

Refer bouncy result issue blog in ES for more info.

Upvotes: 1

Related Questions