Size from or Search After

Hello,

I'm looking into the size from and search after and want to know the difference between what is going on under the hood. It seems based on the documentation that the size from needs to sort all of the data and returns the first size + from documents to the coordinating node which discards all but the final few that are returned. Why does it return to the coordinating node the entire set of documents instead of the index (or complex index) that was searched on?

In comparison, search after knows what result to search after (based on the index or complex index returned) and should throw all the results before it in a bucket and sort the rest, and only return to the coordinating node the documents that need to be returned. Is my understanding of search after and size from correct?

Assuming a single shard and you are getting the next page in a paginated list, (say page 101 with 20 documents per page), which search is faster and why?

Thanks

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