Possible to get 0 count facet values back?


(David Bashford) #1

Old Solr user, brand new ElasticSearch user. With Solr if I do date
faceting and use a 24 hour range with a 1 hour gap, it'll return 24 results
with the corresponding values, even if the value is 0, which is real useful
when my goal is to take those numbers and toss them on a nice evenly spaced
line chart. You sort of expect that if only 2 hours of the day had hits,
that you'd have a long flatline with 2 spikes.

Can't quite figure out how to get ES to return me the 0 values. Is that
possible or do I need to hand wedge them in.

Thanks so much!


(Shay Banon) #2

Which facet are you using? If its histogram facet, then yes, it will only return buckets that have actual data to reserve space. Most charing systems can fill in the gaps easily for you, where you just need to provide the ones with data.

On Thursday, January 26, 2012 at 9:17 PM, David Bashford wrote:

Old Solr user, brand new ElasticSearch user. With Solr if I do date faceting and use a 24 hour range with a 1 hour gap, it'll return 24 results with the corresponding values, even if the value is 0, which is real useful when my goal is to take those numbers and toss them on a nice evenly spaced line chart. You sort of expect that if only 2 hours of the day had hits, that you'd have a long flatline with 2 spikes.

Can't quite figure out how to get ES to return me the 0 values. Is that possible or do I need to hand wedge them in.

Thanks so much!


(Jamie Matthews) #3

Hi,

Another new ES user here, and I have the same issue as the original author.

On Friday, January 27, 2012 8:47:04 PM UTC, kimchy wrote:

Most charing systems can fill in the gaps easily for you, where you just
need to provide the ones with data.

Just FYI, this is actually not the case with many charting libraries. Say
you have the following data (pseudocode, obviously):

dates: ["March 21st", "March 20th", "March 19th", "March 18th", "March
17th"]
counts: [5, 6, 0, 10, 5]

ElasticSearch will return the following:

dates: ["March 21st", "March 20th", "March 18th", "March 17th"]
counts: [5, 6, 10, 5]

Most charting libraries will actually draw a straight line between 6 and
10, rather than dipping to 0 for March 19th as expected.

Although you can get round this by preprocessing the data, it's quite
fiddly. It'd be really nice if the date histogram facet at least provided
an option to include zero data points.

Cheers,

Jamie


(system) #4