# Pagination in aggregation

**URL:** <https://discuss.elastic.co/t/pagination-in-aggregation/79423>\
**Category:** Elasticsearch\
**Created:** [March 21, 2017, 1:29pm UTC](https://discuss.elastic.co/t/pagination-in-aggregation/79423 "2017-03-21T13:29:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rijvan\_khan\_mogia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rijvan_khan_mogia/32/59859_2.png) [@rijvan\_khan\_mogia](https://discuss.elastic.co/u/rijvan_khan_mogia)\
**Post date:** [March 21, 2017, 1:29pm UTC](https://discuss.elastic.co/t/pagination-in-aggregation/79423/1 "2017-03-21T13:29:29Z")

</div>

How to Use pagination (size and from) in elastic search aggregation?

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [March 21, 2017, 2:59pm UTC](https://discuss.elastic.co/t/pagination-in-aggregation/79423/2 "2017-03-21T14:59:05Z")

</div>

Aggregations don't offer pagination in most cases, due to how they work internally. Terms aggregation, starting in 5.2.0, offers a way to "partition" the terms into groups, which you can fetch independently: [https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-aggregations-bucket-terms-aggregation.html#\_filtering\_values\_with\_partitions](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-aggregations-bucket-terms-aggregation.html#_filtering_values_with_partitions)

For the rest of the aggregations (histograms, ranges, etc), you'll have to "partition" them yourself by selecting a smaller time range, etc.

---

<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 18, 2017, 2:59pm UTC](https://discuss.elastic.co/t/pagination-in-aggregation/79423/3 "2017-04-18T14:59:22Z")

</div>

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