Can you do date histogram with specified number of buckets?


(johnrodey) #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!


(system) #2