Result window is too large


I am facing an issue when using from and size to query the last page
for example: my index contains 122000 documents if I specify size = 100 and from = 121000

I get the following error:
{"type":"illegal_argument_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [10200]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."}}],

I understand that the max result window is limited to 10000 but I am only querying for 100 documents, does this mean it is going through all of the documents and loading it into memory before it returns the last 100 documents?

What would be the best way to query the last 100 documents from a large index?

I have seen posts about this and suggested to use scroll API. I have not found detailed documentations on it though.

I appreciate any help

You can use:

  • the size and from parameters to display by default up to 10000 records to your users. If you want to change this limit, you can change index.max_result_window setting but be aware of the consequences (ie memory).
  • the search after feature to do deep pagination.
  • the Scroll API if you want to extract a resultset to be consumed by another tool later. (Not recommended anymore)
1 Like

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