How to set size limit in GET query

I observed that if my index contains say 6 entry(document) and if I run the query with "size" == 25000 , I am getting following error

> Result window is too large, from + size must be less than or equal to: [10000] but was [25000]. 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

If I change size to 10k ("size" == 10000) in query , I am getting result.

Our application needs to keep querying while index has few document(say 6 document) to large doc (say 50k+).

How to change Size in query dynamically. ?
Is it good practice to first fire _search api without query and read the "totoal" from hits and then call another search with query with size set.

Please suggest.

You can change the limit by setting index.max_result_window in your index settings. See https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#dynamic-index-settings

But, IMO the question is more: what do you want to do?
Display all results to a user? Does this really make sense to show to a user 60k results? But I guess this depends on your use case.

Thanks David .
It helped me.

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