# How to use aggregations in scroll endpoint

**URL:** <https://discuss.elastic.co/t/how-to-use-aggregations-in-scroll-endpoint/114468>\
**Category:** Elasticsearch\
**Created:** [January 8, 2018, 8:40am UTC](https://discuss.elastic.co/t/how-to-use-aggregations-in-scroll-endpoint/114468 "2018-01-08T08:40:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eboy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eboy/32/22172_2.png) [@eboy](https://discuss.elastic.co/u/eboy)\
**Post date:** [January 8, 2018, 8:40am UTC](https://discuss.elastic.co/t/how-to-use-aggregations-in-scroll-endpoint/114468/1 "2018-01-08T08:40:33Z")

</div>

I can not use aggregation in scroll endpoint;  
The operation displays the following images:

 ![2](https://us1.discourse-cdn.com/elastic/original/3X/2/3/23258fbaf10036c92235b80747129ca655e613c9.png) ![1](https://us1.discourse-cdn.com/elastic/original/3X/3/f/3f09fcc108113e2cabcd784e521d24ae20a6b96a.png)

As shown in image 1, I can only modify "max\_size" at last.  
But this should not be the ultimate solution, helping.

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 8, 2018, 8:42am UTC](https://discuss.elastic.co/t/how-to-use-aggregations-in-scroll-endpoint/114468/2 "2018-01-08T08:42:00Z")

</div>

As specified in the [official documentation on scroll search](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html):

> If the request specifies aggregations, only the initial search response will contain the aggregations results.

---

<div class="post-metadata">

**Author:** ![eboy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eboy/32/22172_2.png) [@eboy](https://discuss.elastic.co/u/eboy)\
**Post date:** [January 8, 2018, 8:53am UTC](https://discuss.elastic.co/t/how-to-use-aggregations-in-scroll-endpoint/114468/3 "2018-01-08T08:53:03Z")

</div>

Oh, thank you, I seem to have ignored this line. I also want to ask you for a more than 10,000 data how to do aggregate.I'm confused

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 8, 2018, 8:55am UTC](https://discuss.elastic.co/t/how-to-use-aggregations-in-scroll-endpoint/114468/4 "2018-01-08T08:55:58Z")

</div>

The 10000 limit is only for retrieving document results (i.e. what you get in `hits`), aggregations will work on any number of documents.

---

<div class="post-metadata">

**Author:** ![eboy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eboy/32/22172_2.png) [@eboy](https://discuss.elastic.co/u/eboy)\
**Post date:** [January 8, 2018, 9:05am UTC](https://discuss.elastic.co/t/how-to-use-aggregations-in-scroll-endpoint/114468/5 "2018-01-08T09:05:43Z")

</div>

Oh, that's embarrassing. Thank you for correcting me!!

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 8, 2018, 9:09am UTC](https://discuss.elastic.co/t/how-to-use-aggregations-in-scroll-endpoint/114468/6 "2018-01-08T09:09:06Z")

</div>

No worries, we're all here to learn 😉

---

<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:** [February 5, 2018, 9:09am UTC](https://discuss.elastic.co/t/how-to-use-aggregations-in-scroll-endpoint/114468/7 "2018-02-05T09:09:20Z")

</div>

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