Achieving Pagination in Elasticsearch using Scroll

For my project in Elasticsearch, I was using from and size to give pagination. But the problem I am facing is when it comes to a big result set because as Elasticsearch mentions from+size should never be greater than 10000.

Now the benefit of using From and size was that when representing the result in UI I could jump to any page I want by giving the from and the size value in query. I am not sure how to achieve that using scroll. Lets say I do a search with scroll with given size 50. And the result has 29000 doc, so given the size of result we will have 580 pages, If I click on 101 page how it will behave if we use scroll. Any suggestions how we can handle this ??
Also have gone through search after but looks like for freely jumping to a random page this can't be
used it's ideal for scrolling through pages.
I know we can changes the index.max_result_window but that will surely impact the performance as it uses the heap size. Is there any way we can achieve this without affecting the performance.

In my JSON mapping files, I have "max_result_window" : 200000, and we do not have performance problem.

@xavierfacq right now I am doing the same thing but the issue will be when the data will grow in huge no. Then we have to keep on increasing the window , but to what extent.

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