# Pagination with Aggregation Queries

**URL:** <https://discuss.elastic.co/t/pagination-with-aggregation-queries/115005>\
**Category:** Elasticsearch\
**Created:** [January 11, 2018, 5:48am UTC](https://discuss.elastic.co/t/pagination-with-aggregation-queries/115005 "2018-01-11T05:48:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepak\_Mane](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@Deepak\_Mane](https://discuss.elastic.co/u/Deepak_Mane)\
**Post date:** [January 11, 2018, 5:48am UTC](https://discuss.elastic.co/t/pagination-with-aggregation-queries/115005/1 "2018-01-11T05:48:20Z")

</div>

I have table having more 40 lakhs records. I have to load the data with grouping. After grouping data will be more the 5 lakhs records.

I have tried many solutions but not succeed.

1. From and Size is not supported
2. Include not working as expected
3. Top Hits in Aggregation only give top records

Is there any way please suggest?

---

<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 11, 2018, 6:09am UTC](https://discuss.elastic.co/t/pagination-with-aggregation-queries/115005/2 "2018-01-11T06:09:13Z")

</div>

Note that you can specify any size you want (\<10000) in the `top_hits` aggregation, it doesn't have to return only the top three records.

---

<div class="post-metadata">

**Author:** ![Deepak\_Mane](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@Deepak\_Mane](https://discuss.elastic.co/u/Deepak_Mane)\
**Post date:** [January 11, 2018, 6:57am UTC](https://discuss.elastic.co/t/pagination-with-aggregation-queries/115005/3 "2018-01-11T06:57:40Z")

</div>

Thanks Val.

Yes, I can only set Size in top\_hits. but not From offset (Limit start Offset).  
And I have huge data more than (\>10000). I have to load that with pagination. Can you please suggest how I can do this (If Example) ?

---

<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 8, 2018, 7:07am UTC](https://discuss.elastic.co/t/pagination-with-aggregation-queries/115005/4 "2018-02-08T07:07:05Z")

</div>

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