Date Histogram - Automatically Setting Interval for Nice Bar Charts


(Michael Sander) #1

Hi,

Is there any way for Elastic Search to automatically select the interval
for a date histogram facet based on a simple heuristic? This is useful for
creating pretty bar charts without guessing a good interval size (like herehttps://www.docketalarm.com/search/PTAB/dockets/?q=petition&s=on,
and see below, for example).

Ideally, the heuristic would be something like this:

  • Set the interval to the smallest interval possible where there are at
    least X buckets.
    A reasonable value of X could be 5, but ideally could be adjusted.

When implementing this, you would want the bucket count to include empty
buckets. For example, if there were two values, jan. 1, 1990, and Jan. 1.
1992, and the interval was a year, then there would be 3 buckets, not 2. So
if X was five, you would want to set interval to months.

Note that this issue is similar to automatically setting the bucket size
for any histogram facet, not just date histograms.

Here's an example of a date_histogram chart I am making:

https://lh3.googleusercontent.com/-aHkIVXPZc6A/UnvIvpvVUzI/AAAAAAAACMU/QRgL4XJ_SOs/s1600/chart.png
Thanks!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Michael Sander) #2

I realized there was a typo in my heuristic. It should be:

  • Set the interval to the largest interval possible where there are at
    least X buckets.

On Thursday, November 7, 2013 12:09:33 PM UTC-5, Michael Sander wrote:

Hi,

Is there any way for Elastic Search to automatically select the interval
for a date histogram facet based on a simple heuristic? This is useful for
creating pretty bar charts without guessing a good interval size (like
here https://www.docketalarm.com/search/PTAB/dockets/?q=petition&s=on,
and see below, for example).

Ideally, the heuristic would be something like this:

  • Set the interval to the smallest interval possible where there are at
    least X buckets.
    A reasonable value of X could be 5, but ideally could be adjusted.

When implementing this, you would want the bucket count to include empty
buckets. For example, if there were two values, jan. 1, 1990, and Jan. 1.
1992, and the interval was a year, then there would be 3 buckets, not 2. So
if X was five, you would want to set interval to months.

Note that this issue is similar to automatically setting the bucket size
for any histogram facet, not just date histograms.

Here's an example of a date_histogram chart I am making:

https://lh3.googleusercontent.com/-aHkIVXPZc6A/UnvIvpvVUzI/AAAAAAAACMU/QRgL4XJ_SOs/s1600/chart.png
Thanks!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3