# Is there any way to get the total number of buckets a aggs generated?

**URL:** <https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562>\
**Category:** Elasticsearch\
**Created:** [September 2, 2014, 1:38am UTC](https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562 "2014-09-02T01:38:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![11149](https://avatars.discourse-cdn.com/v4/letter/1/da6949/32.png) [@11149](https://discuss.elastic.co/u/11149)\
**Post date:** [September 2, 2014, 1:38am UTC](https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562/1 "2014-09-02T01:38:51Z")

</div>

we do a aggregation, and we only want to get the number of buckets it  
generated, is there any way to archive this goal ?

Thanks

--  
不学习，不知道

--  
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/CA%2BJstLCU7Pj3YF2Oy2SXH%2Brc4kxMMY87dRxoqes\_wgAUvs8chg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLCU7Pj3YF2Oy2SXH%2Brc4kxMMY87dRxoqes_wgAUvs8chg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![11149](https://avatars.discourse-cdn.com/v4/letter/1/da6949/32.png) [@11149](https://discuss.elastic.co/u/11149)\
**Post date:** [September 2, 2014, 1:56am UTC](https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562/2 "2014-09-02T01:56:37Z")

</div>

To some degree, I can archive this goal by setting size: 0 in the terms  
aggs to list all the generated buckets, but it really consumes much memory,  
so is there any internal API to do this job ?

Thanks.

2014-09-02 9:38 GMT+08:00 panfei [cnweike@gmail.com](mailto:cnweike@gmail.com):

> we do a aggregation, and we only want to get the number of buckets it  
> generated, is there any way to archive this goal ?
> 
> Thanks
> 
> --  
> 不学习，不知道

--  
不学习，不知道

--  
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/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [September 2, 2014, 2:00am UTC](https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562/3 "2014-09-02T02:00:25Z")

</div>

Hello ,

Setting search\_type to count avoids executing the fetch phase of the search  
making the request more efficient. See Search Type  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-search-type.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-search-type.html)  
for more information on the search\_type parameter.

Thanks  
Vineeth

On Tue, Sep 2, 2014 at 7:26 AM, panfei [cnweike@gmail.com](mailto:cnweike@gmail.com) wrote:

> To some degree, I can archive this goal by setting size: 0 in the terms  
> aggs to list all the generated buckets, but it really consumes much memory,  
> so is there any internal API to do this job ?
> 
> Thanks.
> 
> 2014-09-02 9:38 GMT+08:00 panfei [cnweike@gmail.com](mailto:cnweike@gmail.com):
> 
> we do a aggregation, and we only want to get the number of buckets it
> 
> > generated, is there any way to archive this goal ?
> > 
> > Thanks
> > 
> > --  
> > 不学习，不知道
> 
> --  
> 不学习，不知道
> 
> --  
> 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/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![11149](https://avatars.discourse-cdn.com/v4/letter/1/da6949/32.png) [@11149](https://discuss.elastic.co/u/11149)\
**Post date:** [September 2, 2014, 2:43am UTC](https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562/4 "2014-09-02T02:43:34Z")

</div>

Hi vineeth, thanks for the tips, but I really want to know the number of  
the buckets generated by the aggs. a bucket\_count's value (like the  
doc\_count's value) in the response.

2014-09-02 10:00 GMT+08:00 vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com):

> Hello ,
> 
> Setting search\_type to count avoids executing the fetch phase of the  
> search making the request more efficient. See Search Type  
> [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-search-type.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-search-type.html)  
> for more information on the search\_type parameter.
> 
> Thanks  
> Vineeth
> 
> On Tue, Sep 2, 2014 at 7:26 AM, panfei [cnweike@gmail.com](mailto:cnweike@gmail.com) wrote:
> 
> > To some degree, I can archive this goal by setting size: 0 in the terms  
> > aggs to list all the generated buckets, but it really consumes much memory,  
> > so is there any internal API to do this job ?
> > 
> > Thanks.
> > 
> > 2014-09-02 9:38 GMT+08:00 panfei [cnweike@gmail.com](mailto:cnweike@gmail.com):
> > 
> > we do a aggregation, and we only want to get the number of buckets it
> > 
> > > generated, is there any way to archive this goal ?
> > > 
> > > Thanks
> > > 
> > > --  
> > > 不学习，不知道
> > 
> > --  
> > 不学习，不知道
> > 
> > --  
> > 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/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> 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/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
不学习，不知道

--  
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/CA%2BJstLDwhNFgLaECiiW5siF08o%3DaMmpAL05Xbu3n2F%2BrB%3DibRg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLDwhNFgLaECiiW5siF08o%3DaMmpAL05Xbu3n2F%2BrB%3DibRg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [September 2, 2014, 3:31am UTC](https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562/5 "2014-09-02T03:31:14Z")

</div>

Hello ,

Couple of options here.  
Add the count aggregation -

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

{  
"aggregations": {  
"aggs": {  
"value\_count": {  
"field": "names"  
}  
}  
}  
}

## Or , set the size as 0 for the aggregation , it will return all the buckets

> <https://stackoverflow.com/questions/22927098/show-all-elasticsearch-aggregation-results-buckets-and-not-just-10>

This might not be a good idea in case the number of buckets are too large.

But again , the number of buckets seems to be a basic requirement and i  
feel there should be some other better way to do it.  
I will file an issue , if i dont find one.

Thanks  
Vineeth

On Tue, Sep 2, 2014 at 8:13 AM, panfei [cnweike@gmail.com](mailto:cnweike@gmail.com) wrote:

> Hi vineeth, thanks for the tips, but I really want to know the number of  
> the buckets generated by the aggs. a bucket\_count's value (like the  
> doc\_count's value) in the response.
> 
> 2014-09-02 10:00 GMT+08:00 vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com):
> 
> > Hello ,
> > 
> > Setting search\_type to count avoids executing the fetch phase of the  
> > search making the request more efficient. See Search Type  
> > [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-search-type.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-search-type.html)  
> > for more information on the search\_type parameter.
> > 
> > Thanks  
> > Vineeth
> > 
> > On Tue, Sep 2, 2014 at 7:26 AM, panfei [cnweike@gmail.com](mailto:cnweike@gmail.com) wrote:
> > 
> > > To some degree, I can archive this goal by setting size: 0 in the terms  
> > > aggs to list all the generated buckets, but it really consumes much memory,  
> > > so is there any internal API to do this job ?
> > > 
> > > Thanks.
> > > 
> > > 2014-09-02 9:38 GMT+08:00 panfei [cnweike@gmail.com](mailto:cnweike@gmail.com):
> > > 
> > > we do a aggregation, and we only want to get the number of buckets it
> > > 
> > > > generated, is there any way to archive this goal ?
> > > > 
> > > > Thanks
> > > > 
> > > > --  
> > > > 不学习，不知道
> > > 
> > > --  
> > > 不学习，不知道
> > > 
> > > --  
> > > 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/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 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/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> 不学习，不知道
> 
> --  
> 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/CA%2BJstLDwhNFgLaECiiW5siF08o%3DaMmpAL05Xbu3n2F%2BrB%3DibRg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLDwhNFgLaECiiW5siF08o%3DaMmpAL05Xbu3n2F%2BrB%3DibRg%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLDwhNFgLaECiiW5siF08o%3DaMmpAL05Xbu3n2F%2BrB%3DibRg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLDwhNFgLaECiiW5siF08o%3DaMmpAL05Xbu3n2F%2BrB%3DibRg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAGdPd5kV9Qi%3D4UWY4HG0E4b9mefT8NnUpUWJ7GgfgjEJBcXbhg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kV9Qi%3D4UWY4HG0E4b9mefT8NnUpUWJ7GgfgjEJBcXbhg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![11149](https://avatars.discourse-cdn.com/v4/letter/1/da6949/32.png) [@11149](https://discuss.elastic.co/u/11149)\
**Post date:** [September 2, 2014, 3:38am UTC](https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562/6 "2014-09-02T03:38:24Z")

</div>

Though this is not the solution, thanks for your advice.

2014-09-02 11:31 GMT+08:00 vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com):

> Hello ,
> 
> Couple of options here.  
> Add the count aggregation -  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-valuecount-aggregation.html)
> 
> {  
> "aggregations": {  
> "aggs": {  
> "value\_count": {  
> "field": "names"  
> }  
> }  
> }  
> }
> 
> Or , set the size as 0 for the aggregation , it will return all the  
> buckets -  
> [Show all Elasticsearch aggregation results/buckets and not just 10 - Stack Overflow](http://stackoverflow.com/questions/22927098/list-all-buckets-on-an-elasticsearch-aggregation)  
> This might not be a good idea in case the number of buckets are too large.
> 
> But again , the number of buckets seems to be a basic requirement and i  
> feel there should be some other better way to do it.  
> I will file an issue , if i dont find one.
> 
> Thanks  
> Vineeth
> 
> On Tue, Sep 2, 2014 at 8:13 AM, panfei [cnweike@gmail.com](mailto:cnweike@gmail.com) wrote:
> 
> > Hi vineeth, thanks for the tips, but I really want to know the number of  
> > the buckets generated by the aggs. a bucket\_count's value (like the  
> > doc\_count's value) in the response.
> > 
> > 2014-09-02 10:00 GMT+08:00 vineeth mohan [vm.vineethmohan@gmail.com](mailto:vm.vineethmohan@gmail.com):
> > 
> > > Hello ,
> > > 
> > > Setting search\_type to count avoids executing the fetch phase of the  
> > > search making the request more efficient. See Search Type  
> > > [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-search-type.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-search-type.html)  
> > > for more information on the search\_type parameter.
> > > 
> > > Thanks  
> > > Vineeth
> > > 
> > > On Tue, Sep 2, 2014 at 7:26 AM, panfei [cnweike@gmail.com](mailto:cnweike@gmail.com) wrote:
> > > 
> > > > To some degree, I can archive this goal by setting size: 0 in the terms  
> > > > aggs to list all the generated buckets, but it really consumes much memory,  
> > > > so is there any internal API to do this job ?
> > > > 
> > > > Thanks.
> > > > 
> > > > 2014-09-02 9:38 GMT+08:00 panfei [cnweike@gmail.com](mailto:cnweike@gmail.com):
> > > > 
> > > > we do a aggregation, and we only want to get the number of buckets it
> > > > 
> > > > > generated, is there any way to archive this goal ?
> > > > > 
> > > > > Thanks
> > > > > 
> > > > > --  
> > > > > 不学习，不知道
> > > > 
> > > > --  
> > > > 不学习，不知道
> > > > 
> > > > --  
> > > > 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/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > > 
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > 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/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DFLQQVJHMj0AzNr4%3DL3G5vv3h%3DR9FzXY-5k8CEoeorXg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > 不学习，不知道
> > 
> > --  
> > 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/CA%2BJstLDwhNFgLaECiiW5siF08o%3DaMmpAL05Xbu3n2F%2BrB%3DibRg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLDwhNFgLaECiiW5siF08o%3DaMmpAL05Xbu3n2F%2BrB%3DibRg%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLDwhNFgLaECiiW5siF08o%3DaMmpAL05Xbu3n2F%2BrB%3DibRg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLDwhNFgLaECiiW5siF08o%3DaMmpAL05Xbu3n2F%2BrB%3DibRg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> 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/CAGdPd5kV9Qi%3D4UWY4HG0E4b9mefT8NnUpUWJ7GgfgjEJBcXbhg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kV9Qi%3D4UWY4HG0E4b9mefT8NnUpUWJ7GgfgjEJBcXbhg%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kV9Qi%3D4UWY4HG0E4b9mefT8NnUpUWJ7GgfgjEJBcXbhg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kV9Qi%3D4UWY4HG0E4b9mefT8NnUpUWJ7GgfgjEJBcXbhg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
不学习，不知道

--  
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/CA%2BJstLB1Bz0r\_CGv6NTBL\_Vm7UC%3Dqqnr5y3dBgffuHVmpC-ZsQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLB1Bz0r_CGv6NTBL_Vm7UC%3Dqqnr5y3dBgffuHVmpC-ZsQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![mooky](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@mooky](https://discuss.elastic.co/u/mooky)\
**Post date:** [September 4, 2014, 5:46pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562/7 "2014-09-04T17:46:38Z")

</div>

I tend to agree that knowing the total # of buckets would be universally  
useful.

Even though you may only want to "show" 10 buckets to the user, you may  
also want to show that there are "15 more..." - and then allow the user to  
expand on that to see all 25.

On Tuesday, 2 September 2014 04:31:23 UTC+1, vineeth mohan wrote:

> But again , the number of buckets seems to be a basic requirement and i  
> feel there should be some other better way to do it.  
> I will file an issue , if i dont find one.

--  
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/9b6da6cd-c960-4293-9182-0150eaa4057e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9b6da6cd-c960-4293-9182-0150eaa4057e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [September 4, 2014, 6:19pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562/8 "2014-09-04T18:19:28Z")

</div>

I think this is something the cardinality[1] aggregation can be used for?

[1]

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Thu, Sep 4, 2014 at 7:46 PM, mooky [nick.minutello@gmail.com](mailto:nick.minutello@gmail.com) wrote:

> I tend to agree that knowing the total # of buckets would be universally  
> useful.
> 
> Even though you may only want to "show" 10 buckets to the user, you may  
> also want to show that there are "15 more..." - and then allow the user to  
> expand on that to see all 25.
> 
> On Tuesday, 2 September 2014 04:31:23 UTC+1, vineeth mohan wrote:
> 
> > But again , the number of buckets seems to be a basic requirement and i  
> > feel there should be some other better way to do it.  
> > I will file an issue , if i dont find one.
> 
> --  
> 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/9b6da6cd-c960-4293-9182-0150eaa4057e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9b6da6cd-c960-4293-9182-0150eaa4057e%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/9b6da6cd-c960-4293-9182-0150eaa4057e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/9b6da6cd-c960-4293-9182-0150eaa4057e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
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/CAL6Z4j746fLxV8oRBm-n-X2CQ%3DzgOVsLgODYCqWm8Yta631x7w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j746fLxV8oRBm-n-X2CQ%3DzgOVsLgODYCqWm8Yta631x7w%40mail.gmail.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, 1:04am UTC](https://discuss.elastic.co/t/is-there-any-way-to-get-the-total-number-of-buckets-a-aggs-generated/19562/9 "2017-07-06T01:04:18Z")

</div>


