# Aggregegation buckets count

**URL:** <https://discuss.elastic.co/t/aggregegation-buckets-count/21270>\
**Category:** Elasticsearch\
**Created:** [December 16, 2014, 8:48am UTC](https://discuss.elastic.co/t/aggregegation-buckets-count/21270 "2014-12-16T08:48:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tom_4/32/1045_2.png) [@Tom\_4](https://discuss.elastic.co/u/Tom_4)\
**Post date:** [December 16, 2014, 8:48am UTC](https://discuss.elastic.co/t/aggregegation-buckets-count/21270/1 "2014-12-16T08:48:50Z")

</div>

Hi,

is there a way to get just the count of buckets (not the count of docs,  
which works i know) of an aggregation without receiving the whole buckets  
content?

thx, Tom

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/99c0776d-8059-432d-b2a7-5ce115dae9d2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/99c0776d-8059-432d-b2a7-5ce115dae9d2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Rich\_Somerfield](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@Rich\_Somerfield](https://discuss.elastic.co/u/Rich_Somerfield)\
**Post date:** [December 16, 2014, 10:02am UTC](https://discuss.elastic.co/t/aggregegation-buckets-count/21270/2 "2014-12-16T10:02:04Z")

</div>

Hi Tom,

I think the "Cardinality" aggregation is what you want.

e.g. :

{  
...query...  
},  
"aggregations": {  
"totalUniqueUsers": {  
"cardinality": {  
"field": "username"  
}  
}  
}

-Rich

On Tuesday, December 16, 2014 8:48:51 AM UTC, Tom wrote:

> Hi,
> 
> is there a way to get just the count of buckets (not the count of docs,  
> which works i know) of an aggregation without receiving the whole buckets  
> content?
> 
> thx, Tom

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/834082a2-1336-4c2d-a4b0-5bfbe52cafb1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/834082a2-1336-4c2d-a4b0-5bfbe52cafb1%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Tom\_4](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tom_4/32/1045_2.png) [@Tom\_4](https://discuss.elastic.co/u/Tom_4)\
**Post date:** [December 16, 2014, 10:37am UTC](https://discuss.elastic.co/t/aggregegation-buckets-count/21270/3 "2014-12-16T10:37:25Z")

</div>

Hi Rich,

perfect, that's it, thx a lot.

Cheers, Tom

Am Dienstag, 16. Dezember 2014 11:02:04 UTC+1 schrieb Rich Somerfield:

> Hi Tom,
> 
> I think the "Cardinality" aggregation is what you want.
> 
> e.g. :
> 
> {  
> ...query...  
> },  
> "aggregations": {  
> "totalUniqueUsers": {  
> "cardinality": {  
> "field": "username"  
> }  
> }  
> }
> 
> -Rich
> 
> On Tuesday, December 16, 2014 8:48:51 AM UTC, Tom wrote:
> 
> > Hi,
> > 
> > is there a way to get just the count of buckets (not the count of docs,  
> > which works i know) of an aggregation without receiving the whole buckets  
> > content?
> > 
> > thx, Tom

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a36ad00b-5f7e-4e36-9c75-928befb63fea%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a36ad00b-5f7e-4e36-9c75-928befb63fea%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Rich\_Somerfield](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@Rich\_Somerfield](https://discuss.elastic.co/u/Rich_Somerfield)\
**Post date:** [December 16, 2014, 12:48pm UTC](https://discuss.elastic.co/t/aggregegation-buckets-count/21270/4 "2014-12-16T12:48:35Z")

</div>

Happy to help.

On Tuesday, December 16, 2014 10:37:25 AM UTC, Tom wrote:

> Hi Rich,
> 
> perfect, that's it, thx a lot.
> 
> Cheers, Tom
> 
> Am Dienstag, 16. Dezember 2014 11:02:04 UTC+1 schrieb Rich Somerfield:
> 
> > Hi Tom,
> > 
> > I think the "Cardinality" aggregation is what you want.
> > 
> > e.g. :
> > 
> > {  
> > ...query...  
> > },  
> > "aggregations": {  
> > "totalUniqueUsers": {  
> > "cardinality": {  
> > "field": "username"  
> > }  
> > }  
> > }
> > 
> > -Rich
> > 
> > On Tuesday, December 16, 2014 8:48:51 AM UTC, Tom wrote:
> > 
> > > Hi,
> > > 
> > > is there a way to get just the count of buckets (not the count of docs,  
> > > which works i know) of an aggregation without receiving the whole buckets  
> > > content?
> > > 
> > > thx, Tom

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/470ec648-20c8-4967-9c38-fa6ab407c8fe%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/470ec648-20c8-4967-9c38-fa6ab407c8fe%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:43am UTC](https://discuss.elastic.co/t/aggregegation-buckets-count/21270/5 "2017-07-06T00:43:27Z")

</div>


