Remove empty data buckets with @timestan


How to remove empty data buckets { "min_doc_count":1} didn't work.

As I understand correctly, for your case presented on the screenshot you wouldn't like to display months from Jul to Dec because they are empty? Unfortunately the chart you're using is a Date histogram and it is impossible to do that over time.

any other solution instead of a Date histogram? I split data using some filters and I want to show it according to Months.

There's one hacky workaround that could work, but it comes with their own set of problems.

  1. Create a scripted field based on your timefield month_of_the_year

  2. use 'terms' aggregation instead of date histogram.

The limitations are that the months will not be sorted by 'jan, feb, etc' but only by ascending or descending value. Also, the months across multiple years would be grouped together.

1 Like

Thanks for the solution.. unfortunately, this didn't work..

Hmmm, could you paste your configuration screenshot here? Does scripted field return the correct value?

image



Data is correct..