Date range aggregation
/ Date_range, / AggregationDate range aggregation #
A multi-bucket aggregation like
range, but for date
fields. Each bucket is a from/to period you name — “before the launch”,
“launch week”, “after” — which is the shape reporting questions
naturally take, rather than the uniform grid of
date_histogram.
How it works #
Bounds are epoch milliseconds: from accepts a number (or a numeric
string) and is inclusive, to is exclusive, and either may be omitted
for an open-ended period. Date strings like "2024-06-04" are not
parsed by the aggregation — convert them to epoch millis first (the
teaching examples below show the constants).