Auto_date_histogram

Auto date histogram aggregation

/ Auto_date_histogram, / Aggregation

Auto date histogram aggregation #

A multi-bucket aggregation like date_histogram, but you choose the NUMBER of buckets and the engine picks the interval that best fits. It solves the cold-start problem of time charts: when you do not know whether the data spans minutes or years, you state the resolution you want on screen and let the ladder decide the unit.

How it works #

The engine reads every date value (epoch milliseconds), takes the data extent max − min, and divides by the buckets target to get a rough per-bucket width. That width is matched against a fixed ladder, and the smallest interval that covers it wins: 1s, 1m, 5m, 10m, 30m, 1h, 6h, 12h, 1d, 1w as fixed intervals; beyond a week the calendar units month, quarter, year (and multi-year multiples for very long extents). The pick is one closed-form step, not an iterative search.

...