# Aggregate on Pagniated Query

**URL:** <https://discuss.elastic.co/t/aggregate-on-pagniated-query/39330>\
**Category:** Elasticsearch\
**Created:** [January 15, 2016, 1:39pm UTC](https://discuss.elastic.co/t/aggregate-on-pagniated-query/39330 "2016-01-15T13:39:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sundar\_V](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sundar_v/32/6928_2.png) [@Sundar\_V](https://discuss.elastic.co/u/Sundar_V)\
**Post date:** [January 15, 2016, 1:39pm UTC](https://discuss.elastic.co/t/aggregate-on-pagniated-query/39330/1 "2016-01-15T13:39:45Z")

</div>

Hello,

I’m doing a query and then aggregating the results. The query itself is paginated (I use from:0 and size:20). However, the data that is passed to aggregate is not this pagniated query, but the total matching hits.

Is that correct?

Is there a way to pass only the paginated query results for aggregation

---

<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 5, 2017, 11:24pm UTC](https://discuss.elastic.co/t/aggregate-on-pagniated-query/39330/2 "2017-07-05T23:24:06Z")

</div>


