date_histogram
The function date_histogram(str agg_name, str fieldname, str time_interval)
allows to create histograms of the aggregation results, by date.
However, results will be segmented as a histogram with resolution according to time_interval
. The aggregation result will be stored under a key named "agg_name" in results
.
Input
agg_name(str) - Specifies the key that will be used to store the aggregation result under the query result.
fieldname(str) - The name of the field to aggregate. params[fieldname] must be of type float or int.
time_interval(str) - The resolution of the interval. The available units for are s/m/h/d.
Example:
In the above example, the aggregation results will be binned into a histogram with bins of width 1d.
Last updated