# Is Pagination Possible on Aggregation in Elastic 6.6.2

**URL:** <https://discuss.elastic.co/t/is-pagination-possible-on-aggregation-in-elastic-6-6-2/174510>\
**Category:** Elasticsearch\
**Created:** [March 29, 2019, 9:50am UTC](https://discuss.elastic.co/t/is-pagination-possible-on-aggregation-in-elastic-6-6-2/174510 "2019-03-29T09:50:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ravi\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravi_jain/32/42891_2.png) [@Ravi\_Jain](https://discuss.elastic.co/u/Ravi_Jain)\
**Post date:** [March 29, 2019, 9:50am UTC](https://discuss.elastic.co/t/is-pagination-possible-on-aggregation-in-elastic-6-6-2/174510/1 "2019-03-29T09:50:36Z")

</div>

I want to perform pagination aggregation, is it possible in Elastic Search

---

<div class="post-metadata">

**Author:** ![Ignacio\_Vera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ignacio_vera/32/36674_2.png) [@Ignacio\_Vera](https://discuss.elastic.co/u/Ignacio_Vera)\
**Post date:** [March 29, 2019, 9:58am UTC](https://discuss.elastic.co/t/is-pagination-possible-on-aggregation-in-elastic-6-6-2/174510/2 "2019-03-29T09:58:20Z")

</div>

I think this aggregation should help you:

[https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-aggregations-bucket-composite-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-aggregations-bucket-composite-aggregation.html)

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 29, 2019, 10:14am UTC](https://discuss.elastic.co/t/is-pagination-possible-on-aggregation-in-elastic-6-6-2/174510/3 "2019-03-29T10:14:57Z")

</div>

Composite aggs will work if you are sorting results by the key of the bucket. However if you want to sort them by a child aggregation (e.g. `product` keywords sorted by sum of `sale` double fields) then you'd need a different approach.  
This wizard might help understand the trade-offs [https://embed.plnkr.co/zCPNM2OcM3lxEYg4M7rD/](https://embed.plnkr.co/zCPNM2OcM3lxEYg4M7rD/)

---

<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:** [April 26, 2019, 10:15am UTC](https://discuss.elastic.co/t/is-pagination-possible-on-aggregation-in-elastic-6-6-2/174510/4 "2019-04-26T10:15:03Z")

</div>

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