Reputation: 817
I've recently written an application that makes queries to Elasticsearch. I've always used the "from" and "size" fields to take care of pagination. I realized today that this doesn't work for datasets greater than 10,000.
I've looked into both scroll and search_after, and although both make sense I'm not sure which I could use for my application. Here are my requirements
Upvotes: 0
Views: 222
Reputation: 21
Another solution can be to increase max_result_window property of the index. This will allow you to fetch more data using from and size.
Beware that it will increase the heap memory usage and time taken to fetch the results as the size of the result depends on the from+size. It first fetches the from+size results and stores it in memory then returns from amount of data. So, more from+size, more heap memory usage and more time take to fetch the results.
In the documentation it says:
index.max_result_window The maximum value of from + size for searches to this index. Defaults to 10000. Search requests take heap memory and time proportional to from + size and this limits that memory.
Upvotes: 1