# How to set size limit in GET query

**URL:** <https://discuss.elastic.co/t/how-to-set-size-limit-in-get-query/169338>\
**Category:** Elasticsearch\
**Created:** [February 21, 2019, 6:41am UTC](https://discuss.elastic.co/t/how-to-set-size-limit-in-get-query/169338 "2019-02-21T06:41:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![smidev11](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@smidev11](https://discuss.elastic.co/u/smidev11)\
**Post date:** [February 21, 2019, 6:41am UTC](https://discuss.elastic.co/t/how-to-set-size-limit-in-get-query/169338/1 "2019-02-21T06:41:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 21, 2019, 7:54am UTC](https://discuss.elastic.co/t/how-to-set-size-limit-in-get-query/169338/2 "2019-02-21T07:54:43Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![smidev11](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@smidev11](https://discuss.elastic.co/u/smidev11)\
**Post date:** [February 21, 2019, 9:17am UTC](https://discuss.elastic.co/t/how-to-set-size-limit-in-get-query/169338/3 "2019-02-21T09:17:22Z")

</div>

> [@dadoonet](#):
>
> 60k results

Thanks David .  
It helped me.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 21, 2019, 9:17am UTC](https://discuss.elastic.co/t/how-to-set-size-limit-in-get-query/169338/4 "2019-03-21T09:17:22Z")

</div>

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