Skip to content

Feature Request: Date Histogram agg bounds #9531

Closed
@spalger

Description

@spalger

Currently the date_histogram accepts an extended_bounds argument, but it would be great if it offered a bounds argument.

bounds and extended_bounds would be mutually exclusive, but operate similarly with two main differences:

  1. bounds would effectively act like a filter and ignore any documents that did not fit into the specified time window
  2. the bounds argument would continue to be an object with min and max properties, but could optionally have a target_buckets property. Specifying the target_buckets would automatically calculate an interval interval that cleanly dividing the specified bounds into about as many buckets as requested.

Here is an example request that would ideally return 52 weekly buckets. Note that a "clean" interval (1w) is chosen over an interval that would have provided exactly 50 buckets.

{
  "x-axis": {
    "date_histogram": {
      "field": "@timestamp",
      "bounds": {
        "min": 1388534400000, // 2014-01-01T00:00:00.000Z
        "max": 1420070399999, // 2014-12-31T23:59:59.999Z
        "target_buckets": 50
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions