# Elasticsearch- Aggregation pagination

**URL:** <https://discuss.elastic.co/t/elasticsearch-aggregation-pagination/18929>\
**Category:** Elasticsearch\
**Created:** [July 28, 2014, 1:13pm UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-pagination/18929 "2014-07-28T13:13:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manoj\_Singh](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@Manoj\_Singh](https://discuss.elastic.co/u/Manoj_Singh)\
**Post date:** [July 28, 2014, 1:13pm UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-pagination/18929/1 "2014-07-28T13:13:50Z")

</div>

I am working on elastic search. I have to show report data but I need to  
group by them. Since I have large amount of data so I can not paginate  
client side. Can anyone explain how we can do pagination while using  
aggregation.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/51ca6d7f-d673-4a20-9eba-592f35951b3e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/51ca6d7f-d673-4a20-9eba-592f35951b3e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Daniel\_Yim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel_yim/32/1367_2.png) [@Daniel\_Yim](https://discuss.elastic.co/u/Daniel_Yim)\
**Post date:** [July 28, 2014, 5:01pm UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-pagination/18929/2 "2014-07-28T17:01:37Z")

</div>

I would like to know the answer to this question as well.

Adrien says in this thread that aggregation pagination is not supported at  
the moment  
[http://elasticsearch-users.115913.n3.nabble.com/ES-aggregation-and-pagination-td4052774.html](http://elasticsearch-users.115913.n3.nabble.com/ES-aggregation-and-pagination-td4052774.html),  
but they seem to have come close to a solution.

On Monday, July 28, 2014 8:13:51 AM UTC-5, Manoj Singh wrote:

> I am working on Elasticsearch. I have to show report data but I need to  
> group by them. Since I have large amount of data so I can not paginate  
> client side. Can anyone explain how we can do pagination while using  
> aggregation.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/200d7b92-eb8e-46a7-9863-05e852522775%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/200d7b92-eb8e-46a7-9863-05e852522775%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 29, 2014, 7:58am UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-pagination/18929/3 "2014-07-29T07:58:55Z")

</div>

Hi Daniel and Manoj,

Aggregations don't support pagination. This is something that would need to  
be handled on the client side. For example, if you display the first page  
using a terms aggregations of size 100 and shard\_size 1000 and the user  
wants to see the second page, you would need to run the query again with  
size=200, shard\_size=1000 and ignore the top 100 terms.

It is a good idea to keep the shard\_size constant across pages so that the  
accuracy issues[1] of the terms aggregation remain the same.

[1] [https://github.com/elasticsearch/elasticsearch/issues/1305](https://github.com/elasticsearch/elasticsearch/issues/1305)

On Mon, Jul 28, 2014 at 7:01 PM, Daniel Yim [danielyim@gmail.com](mailto:danielyim@gmail.com) wrote:

> I would like to know the answer to this question as well.
> 
> Adrien says in this thread that aggregation pagination is not supported at  
> the moment  
> [http://elasticsearch-users.115913.n3.nabble.com/ES-aggregation-and-pagination-td4052774.html](http://elasticsearch-users.115913.n3.nabble.com/ES-aggregation-and-pagination-td4052774.html),  
> but they seem to have come close to a solution.
> 
> On Monday, July 28, 2014 8:13:51 AM UTC-5, Manoj Singh wrote:
> 
> > I am working on Elasticsearch. I have to show report data but I need to  
> > group by them. Since I have large amount of data so I can not paginate  
> > client side. Can anyone explain how we can do pagination while using  
> > aggregation.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/200d7b92-eb8e-46a7-9863-05e852522775%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/200d7b92-eb8e-46a7-9863-05e852522775%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/200d7b92-eb8e-46a7-9863-05e852522775%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/200d7b92-eb8e-46a7-9863-05e852522775%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j5jZWcfFfGGhDCGo6n-f2%3D7FgMjmr2Nybsk\_7bTRfeJQg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j5jZWcfFfGGhDCGo6n-f2%3D7FgMjmr2Nybsk_7bTRfeJQg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:12am UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-pagination/18929/4 "2017-07-06T01:12:35Z")

</div>


