Scrolling or slicing?

Hi,
I'm using queries that can return many documents.
In my UI I would like to split it into "pages" so each page contains a manageable amount of documents.

I read the documentation of scrolling, but if I understand correctly, it will not be sufficient as only the newest scrollId can be used. So if my user wants to view an earlier page it will not be valid. In addition, even if it was valid, I would need to cache all scrollIds in my application.

I also saw the slice option - which sounds more like what I'm trying to achieve - so is this my solution? Should I use a big scroll to hold all the query results and then slice it? I understand there might also be a performance impact with slicing.

Thanks

Hi,

The most important question is:

How many ? :slight_smile:

From that point, it'll be easier to answer

bye,
Xavier

And remember :

https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-search-after.html#search-request-search-after

You can scroll to the default limit of 10,000. And you can increase this value here :
https://www.elastic.co/guide/en/elasticsearch/reference/5.2/index-modules.html#dynamic-index-settings

index.max_result_window

Would your users scroll to 10,000 documents without any other criteria ?

bye,
Xavier

Thanks Xavier.
After some further thought, the UI will not need to show that many documents, so I need the paging just to make sure that I have some limit and I'm not exhausting the memory. In this case what is the better option, scrolling or search_after?

Hi, you don't need to scroll in this case. Just use the from/size parameters.

bye,
Xavier

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