Is there anyway to return empty buckets/intervals for a histogram search on a Date field?


(akmiller) #1

I'm showing a chart that details activity between a start and an end
date and I'm using ElasticSearch, along with the histogram query, to
categorize my activity into 24 hour intervals. It seems ElasticSearch
doesn't return all intervals (within my date range query), but instead
only those that actually have data. Much of the time that probably
makes the most sense and I'm guessing ElasticSearch doesn't even
create the interval if there is no data for it.

However, my question is, is it possible to return all intervals, even
those that have 0 data. I can obviously fill in the gaps in code after
I have retrieved the results, it just seems like it might be more
efficient if I could provide some type of parameter to the histogram
query to instruct it to return all intervals.


(Shay Banon) #2

It can certainly be implemented, but its a shame to do it since it might
create considerable more data to return. It just felt to me that it makes
much more sense to fill in the gaps on the client side, especially when most
charting components out there can do it automatically.

On Wed, Dec 15, 2010 at 11:07 PM, akmiller akmiller@gmail.com wrote:

I'm showing a chart that details activity between a start and an end
date and I'm using ElasticSearch, along with the histogram query, to
categorize my activity into 24 hour intervals. It seems ElasticSearch
doesn't return all intervals (within my date range query), but instead
only those that actually have data. Much of the time that probably
makes the most sense and I'm guessing ElasticSearch doesn't even
create the interval if there is no data for it.

However, my question is, is it possible to return all intervals, even
those that have 0 data. I can obviously fill in the gaps in code after
I have retrieved the results, it just seems like it might be more
efficient if I could provide some type of parameter to the histogram
query to instruct it to return all intervals.


(akmiller) #3

That's why I was thinking it might be good as some type of parameter
that I could send in to instruct it to do that. But I understand the
sentiment of handling it client side as well. Thanks for the quick
response.

On Dec 15, 4:40 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

It can certainly be implemented, but its a shame to do it since it might
create considerable more data to return. It just felt to me that it makes
much more sense to fill in the gaps on the client side, especially when most
charting components out there can do it automatically.

On Wed, Dec 15, 2010 at 11:07 PM, akmiller akmil...@gmail.com wrote:

I'm showing a chart that details activity between a start and an end
date and I'm using ElasticSearch, along with the histogram query, to
categorize my activity into 24 hour intervals. It seems ElasticSearch
doesn't return all intervals (within my date range query), but instead
only those that actually have data. Much of the time that probably
makes the most sense and I'm guessing ElasticSearch doesn't even
create the interval if there is no data for it.

However, my question is, is it possible to return all intervals, even
those that have 0 data. I can obviously fill in the gaps in code after
I have retrieved the results, it just seems like it might be more
efficient if I could provide some type of parameter to the histogram
query to instruct it to return all intervals.


(Shay Banon) #4

Right. By the way, you can use the range facet to maybe work around that.
For example, if you know in advance the ranges you want (for example, break
a month into 4 weeks), then you can simply provide those 4 ranges.

On Thu, Dec 16, 2010 at 12:56 AM, akmiller akmiller@gmail.com wrote:

That's why I was thinking it might be good as some type of parameter
that I could send in to instruct it to do that. But I understand the
sentiment of handling it client side as well. Thanks for the quick
response.

On Dec 15, 4:40 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

It can certainly be implemented, but its a shame to do it since it might
create considerable more data to return. It just felt to me that it makes
much more sense to fill in the gaps on the client side, especially when
most
charting components out there can do it automatically.

On Wed, Dec 15, 2010 at 11:07 PM, akmiller akmil...@gmail.com wrote:

I'm showing a chart that details activity between a start and an end
date and I'm using ElasticSearch, along with the histogram query, to
categorize my activity into 24 hour intervals. It seems ElasticSearch
doesn't return all intervals (within my date range query), but instead
only those that actually have data. Much of the time that probably
makes the most sense and I'm guessing ElasticSearch doesn't even
create the interval if there is no data for it.

However, my question is, is it possible to return all intervals, even
those that have 0 data. I can obviously fill in the gaps in code after
I have retrieved the results, it just seems like it might be more
efficient if I could provide some type of parameter to the histogram
query to instruct it to return all intervals.


(system) #5