# How aggregation work in Java API

**URL:** <https://discuss.elastic.co/t/how-aggregation-work-in-java-api/145649>\
**Category:** Elasticsearch\
**Created:** [August 23, 2018, 5:11am UTC](https://discuss.elastic.co/t/how-aggregation-work-in-java-api/145649 "2018-08-23T05:11:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arepalli.ram1987](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@arepalli.ram1987](https://discuss.elastic.co/u/arepalli.ram1987)\
**Post date:** [August 23, 2018, 5:11am UTC](https://discuss.elastic.co/t/how-aggregation-work-in-java-api/145649/1 "2018-08-23T05:11:51Z")

</div>

Hi

how will work aggregation in java api. i have query which will get the records of 50000 and aggregation result is 15000 records. is it perform the aggregation on 50000 records or 10000 records. why because max output is 10000 only na

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 23, 2018, 5:48am UTC](https://discuss.elastic.co/t/how-aggregation-work-in-java-api/145649/2 "2018-08-23T05:48:58Z")

</div>

Aggregations are computed on the full resultset. Set size: 0 and you will see that it still gives you the same results (even faster).

---

<div class="post-metadata">

**Author:** ![arepalli.ram1987](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@arepalli.ram1987](https://discuss.elastic.co/u/arepalli.ram1987)\
**Post date:** [August 23, 2018, 6:02am UTC](https://discuss.elastic.co/t/how-aggregation-work-in-java-api/145649/3 "2018-08-23T06:02:40Z")

</div>

thank you,

If i get the 15000 output aggregation records how i will get all records.

---

<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:** [September 20, 2018, 6:02am UTC](https://discuss.elastic.co/t/how-aggregation-work-in-java-api/145649/4 "2018-09-20T06:02:40Z")

</div>

Closed on September 20, 2018, 6:02am UTC

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