Can you do date histogram with specified number of buckets?


(Tebring Daly) #1

Looks like the histogram aggregation works currently where each bucket is
based on a user defined time interval, therefore you do not know how many
buckets you will be returned unless you know ahead of time how much time
your data spans.

Is there a way to create a date histogram aggregation in ElasticSearch
where I can define the number of buckets that I want and the bucket
increment be determined during execution based on the oldest and newest
matching document?

I would like to be able to say give me 20 buckets. Thus if the data spans
10 years each bucket is determined a half year, or if it spans 10 minutes
each bucket determined to be 30 seconds.

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/CAPPbrSSJmC4rwfpaOYpygEpA_cjuaTXLLSyVaS4WFRGJEkSLDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Alexander Reelsen) #2

Hey,

right now the interval needs to be defined on query time and is never
dynamically calculated. The main reason is, that for each new document, you
probably have to expand the buckets or you have to have a first to
predetermine the oldest and youngest date of the dataset, which requires an
additional roundtrip across the cluster (also the bucket expansion would
need to occur cross cluster, which sounds like quite an performance impact,
but I am not an aggregregations expert).

--Alex

On Tue, Jun 24, 2014 at 8:07 PM, Tebring Daly tdalytx@gmail.com wrote:

Looks like the histogram aggregation works currently where each bucket is
based on a user defined time interval, therefore you do not know how many
buckets you will be returned unless you know ahead of time how much time
your data spans.

Is there a way to create a date histogram aggregation in ElasticSearch
where I can define the number of buckets that I want and the bucket
increment be determined during execution based on the oldest and newest
matching document?

I would like to be able to say give me 20 buckets. Thus if the data spans
10 years each bucket is determined a half year, or if it spans 10 minutes
each bucket determined to be 30 seconds.

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/CAPPbrSSJmC4rwfpaOYpygEpA_cjuaTXLLSyVaS4WFRGJEkSLDA%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAPPbrSSJmC4rwfpaOYpygEpA_cjuaTXLLSyVaS4WFRGJEkSLDA%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/CAGCwEM9zQwMuG_NxTk6iJer9QKfNJ4-osiBpQicNvn1%2B-Xp3yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3