A fixed interval groups date values into equal durations measured in constant time units. Unlike a calendar interval, it does not adjust for calendar settings and cannot represent months, quarters, or years directly. section 13.3.1
Use fixed intervals when calendar-aware boundaries are unnecessary:
- Choose days, hours, minutes, seconds, or milliseconds. section 13.3.1
- Express a duration with a number and unit, such as 730d or 12h. section 13.3.1
- Use calendar_interval instead when month, quarter, year, or calendar-adjusted boundaries matter. section 13.3.1
Listing 13.12 Histogram with a fixed interval of 2 years (730 days)
GET books/_search
{
"size":0,
"aggs": {
"release_date_histogram": {
"date_histogram": {
"field": "release_date",
"fixed_interval": "730d" #1
}
}
}
}
A date histogram groups book release dates into fixed 730-day buckets. section 13.3.1
