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


(潘飞) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLCU7Pj3YF2Oy2SXH%2Brc4kxMMY87dRxoqes_wgAUvs8chg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(潘飞) #2

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:

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CA%2BJstLD6PPAaYyc19rsdy4pO0MbpxJBYbpBqoteZ%3DMQN3diKcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #3

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
for more information on the search_type parameter.

Thanks
Vineeth

On Tue, Sep 2, 2014 at 7:26 AM, panfei 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:

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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
To view this discussion on the web visit 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.


(潘飞) #4

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:

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
for more information on the search_type parameter.

Thanks
Vineeth

On Tue, Sep 2, 2014 at 7:26 AM, panfei 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:

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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To view this discussion on the web visit 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.


(vineeth mohan-2) #5

Hello ,

Couple of options here.
Add the count aggregation -
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


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 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:

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
for more information on the search_type parameter.

Thanks
Vineeth

On Tue, Sep 2, 2014 at 7:26 AM, panfei 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:

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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kV9Qi%3D4UWY4HG0E4b9mefT8NnUpUWJ7GgfgjEJBcXbhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(潘飞) #6

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

2014-09-02 11:31 GMT+08:00 vineeth mohan vm.vineethmohan@gmail.com:

Hello ,

Couple of options here.
Add the count aggregation -
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 -
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 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:

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
for more information on the search_type parameter.

Thanks
Vineeth

On Tue, Sep 2, 2014 at 7:26 AM, panfei 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:

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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
To view this discussion on the web visit 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.


#7

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9b6da6cd-c960-4293-9182-0150eaa4057e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Adrien Grand) #8

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

[1]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html

On Thu, Sep 4, 2014 at 7:46 PM, mooky 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.
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?utm_medium=email&utm_source=footer
.

For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j746fLxV8oRBm-n-X2CQ%3DzgOVsLgODYCqWm8Yta631x7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #9