Date Histogram

Date Histogram Aggregation groups documents into time intervals, forming buckets based on date or time values. The basic syntax includes the terms

  • "field": specifies the filed over which the aggregation wll be performed

  • "interval": Defines the time interval for creating buckets. Common intervals include "year," "quarter," "month," "week," "day," "hour," "minute," or "second."

Example -

{
  "aggs": {
    "daily_histogram": {
      "date_histogram": {
        "field": "timestamp",
        "interval": "day"
      }
    }
  }
}

In the above example, the result will include a set of buckets, each representing a specific day. Each bucket contains:

Last updated