The date-histogram aggregation query defines a set of bucket based on a given time-unit. For instance, if querying a set of log-events, a date_historgram
aggregations query with interval h
(hour) will divide each log event into a bucket for each hour in the time-span of the matching events. Here's a list of properties:
- field (string)
The property path.
- interval (string)
The time-unit interval for creating bucket. Supported time-unit notations:
y
= YearM
= Monthw
= Weekd
= Dayh
= Hourm
= Minutes
= Second
- format (string)
Output format of date string.
- minDocCount (int)
Only include bucket in result if number of hits <=
minDocCount
.
Here's an example of the date_histogram aggregation:
code/date-histogram-query.json
The above example gives the following result:
code/date-histogram-result.json