# Batch size is too large, size must be less than or equal to: \[10000\] but was \[10001\]. Scroll batch sizes cost as much memory as result windows so they are controlled by the \[index.max\_result\_window\] index level setting

**URL:** <https://discuss.elastic.co/t/batch-size-is-too-large-size-must-be-less-than-or-equal-to-10000-but-was-10001-scroll-batch-sizes-cost-as-much-memory-as-result-windows-so-they-are-controlled-by-the-index-max-result-window-index-level-setting/84876>\
**Category:** Elasticsearch\
**Created:** [May 8, 2017, 4:41am UTC](https://discuss.elastic.co/t/batch-size-is-too-large-size-must-be-less-than-or-equal-to-10000-but-was-10001-scroll-batch-sizes-cost-as-much-memory-as-result-windows-so-they-are-controlled-by-the-index-max-result-window-index-level-setting/84876 "2017-05-08T04:41:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leln](https://avatars.discourse-cdn.com/v4/letter/l/ce73a5/32.png) [@leln](https://discuss.elastic.co/u/leln)\
**Post date:** [May 8, 2017, 4:41am UTC](https://discuss.elastic.co/t/batch-size-is-too-large-size-must-be-less-than-or-equal-to-10000-but-was-10001-scroll-batch-sizes-cost-as-much-memory-as-result-windows-so-they-are-controlled-by-the-index-max-result-window-index-level-setting/84876/1 "2017-05-08T04:41:14Z")

</div>

Hello,

I'm using Elasticsearch 5.1.1 and Nest 5.0 and I'm trying to search items by query.  
This is the code:  
var searchDescriptor = new SearchDescriptor()  
.Index(indexName)  
.Size(itemsPerShard)  
.StoredFields((Field)"Id")  
.Scroll("1m")  
.Sort(ss =\> ss.Ascending(SortSpecialField.DocumentIndexOrder))  
.Query(qd =\> qd  
.QueryString(snd =\> snd  
.Query(deleteByQuery)  
.DefaultOperator(Operator.And))  
);  
var scanResults = client.Search(s =\> searchDescriptor);

When itemsPerShard \> 10.000, I receive this error:  
{Invalid NEST response built from a unsuccessful low level call on POST: /index/\_search?scroll=1m}.  
And in elasticsearch log file:  
Batch size is too large, size must be less than or equal to: [10000] but was [10001]. Scroll batch sizes cost as much memory as result windows so they are controlled by the [index.max\_result\_window] index level setting.

How can I resolve this issue?

Thank you!

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 9, 2017, 9:37am UTC](https://discuss.elastic.co/t/batch-size-is-too-large-size-must-be-less-than-or-equal-to-10000-but-was-10001-scroll-batch-sizes-cost-as-much-memory-as-result-windows-so-they-are-controlled-by-the-index-max-result-window-index-level-setting/84876/2 "2017-05-09T09:37:34Z")

</div>

Why do you want the number of items per shard to be larger than 10000?

---

<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:** [June 6, 2017, 9:46am UTC](https://discuss.elastic.co/t/batch-size-is-too-large-size-must-be-less-than-or-equal-to-10000-but-was-10001-scroll-batch-sizes-cost-as-much-memory-as-result-windows-so-they-are-controlled-by-the-index-max-result-window-index-level-setting/84876/3 "2017-06-06T09:46:47Z")

</div>

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