SearchAfter and possible duplicates?


#1

I've been looking at the docs for Search After and I have a question regarding the last paragraph (emphasis mine):

search_after is not a solution to jump freely to a random page but rather to scroll many queries in parallel. It is very similar to the scroll API but unlike it, the search_after parameter is stateless, it is always resolved against the latest version of the searcher. For this reason the sort order may change during a walk depending on the updates and deletes of your index.

Does this mean that if I search with an ascending sort on a date and (during a walk) the first records date gets set to a date later than the last record in the sort, I'll receive the first record again?


#2

I just did a test and found that you can have duplicates depending on your sort order.

For example, if you sort on an _id then a date then the id is treated as a tiebreaker; so if the first record gets set to a later date then the last record it will not appear at the end.

OTOH if you sort on a date and then an _id the first updated record will appear at the end of the set.


(system) #3

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