Histogram Aggregation: With minimum doc count and extended bounds


(Mark) #1

Hi There,
I'm running ES 2.3.3 and have a question regarding Date Histograms with min doc count and extended bounds. I would like to return all buckets within a given date range (e.g. one month) including buckets with no values with a value of 0. (for ease of graphing)

The following query works correctly, however it does not filter the results to within the date range of 2016-08-01 and 2016-08-02. My understanding from reading the docs is the filter should restrict the result set to be within the bounds of the range queries. I have tried with both a query and a date range filter. The buckets for the past year keep coming through, instead of for just the date range specified.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html#search-aggregations-bucket-histogram-aggregation-extended-bounds

Also, if I remove the extended bounds I only receive the buckets with non-zero values which is also not what I am looking for: min doc count=0 buckets should also be included.


(Mark) #2

The API is buggy. "For filtering buckets, one should nest the histogram aggregation under a range filter aggregation with the appropriate from/to settings." This does not not work as documented.


(Isabel Drost-Fromm) #3

Would you mind filing a Github issue for that in case you haven't already done so?


(system) #4