# Composite aggregation buckets total count

**URL:** https://discuss.elastic.co/t/composite-aggregation-buckets-total-count/137156
**Category:** Elasticsearch
**Created:** [June 24, 2018, 5:03pm UTC](https://discuss.elastic.co/t/composite-aggregation-buckets-total-count/137156 "2018-06-24T17:03:04Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [June 26, 2018, 6:57pm UTC](https://discuss.elastic.co/t/composite-aggregation-buckets-total-count/137156/2 "2018-06-26T18:57:16Z")

</div>

I don't believe there's a way to get the total bucket count, because the `composite` agg doesn't know how many buckets there are until it has paged through them all.

I think the best you can do is keep a running counter client-side and increment it with each page that you receive.

That's the trade-off that `composite` pays; memory-friendly, streaming collection of results at the expense of multiple round-trips and not knowing the buckets up-front.

---

_[View the full topic](https://discuss.elastic.co/t/composite-aggregation-buckets-total-count/137156)._
