New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
min_doc_count=0 doesn't work with a date_histogram with a filter #4843
Comments
I can't really reproduce it, I ran the same queries as you and I get the right responses. What es version are you working with? we introduced
the gaps that are filled are based on the dates in the documents you're aggregating... so the first histogram bucket will be based on the earliest date in the document set and the last bucket will be based on the latest date in the set... then we fill in all gaps between these two buckets. we can consider adding a "range" settings to the histograms which will enable to define the value range (or date range in case of |
@cmaitchison scratch that... I finally managed to reproduce it (it happens when you have a single shard)... will work on a fix |
Wow, nice find! I would never have thought to have mentioned that.
|
Also related to this title, I've found that
The above query should return 60 results, 1 for each second in the minute. If any events are found in that minute then 60 results are returned. If no events are found in that minute then 0 results are returned, when you would expect 60 empty buckets. My use case is zooming in on a series on a chart. The zero value results are very helpful to know where to plot the zeros on the x-axis. |
Another related issue I am finding is that sometimes the intervals do not go back far enough.
returns exactly
But it is missing all of the empty buckets between 1390267432894 and 1390267526000. Again, this is with a 2 shard index on 1.0.0RC1. |
@cmaitchison as I mentioned above, the histogram operates on the dataset and extracts the min/max of the histogram from the documents (the earliest/latest). There is no direct relations between the filter aggregation and the histogram aggregations (aggregations are unaware of other aggregations in their hierarchy). We could potentially add a In the first example you gave, there are no documents in that minute, there are no buckets (as we can't determine the min/max values). For the second example, it might be that the first document in the doc set has a later timestamp than the |
… shard, the reduce call was not propagated properly down the agg hierarchy. Closes #4843
… shard, the reduce call was not propagated properly down the agg hierarchy. Closes #4843
Thanks, @uboness, for your help and excellent explanation. |
@cmaitchison no worries... thank you for the bug report! important one! |
I'm interested in hard range boundaries (returning empty buckets to fill gaps between from and to in the case of missing documents) as well. Is there an issue tracking this, or shall I raise one? |
For anyone who arrived to this thread via Google, hard ranges is supported via the extended_bounds param. http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html |
I'm now experiencing the same issue as reported running es 1.6.0
|
it looks like when nesting a date_histogram within a term aggregation there is no way for the min_doc_count to auto fill the zero results.
|
@taf2 please could you open an issue with a complete recreation which explains the problem? |
… shard, the reduce call was not propagated properly down the agg hierarchy. Closes elastic#4843
Is this bug still there? I am trying to do the same exact thing as the OP right now. |
me too! :) |
And me either. :) |
Hi, i found the same issue but it could be workaround adding the object extended_bounds to the date_histogram aggregation, something like this: {"extended_bounds":{"min":"+timeInit+","max":"+timeFin+"}} where timeInit and timeFin are the same period specified in the range filter in miliseconds I hope this can help somebody. |
I'm trying to create a date_histogram for recent events, where days where no events happen are still shown.
I get a response like this
The empty days are not returned. If I construct the query without the filter, the empty days are returned correctly.
There is also an issue even when the empty days are returned correctly without the filter. If, for example, today is "2014-01-22", and the latest timestamp in my data is "2014-01-17", then the 5 days between these two dates are not returned as empty buckets, though all the empty buckets prior to "2014-01-17" are returned correctly.
The text was updated successfully, but these errors were encountered: