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:
bounds would effectively act like a filter and ignore any documents that did not fit into the specified time window
- 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
}
}
}
}
Currently the date_histogram accepts an
extended_boundsargument, but it would be great if it offered aboundsargument.boundsandextended_boundswould be mutually exclusive, but operate similarly with two main differences:boundswould effectively act like a filter and ignore any documents that did not fit into the specified time windowboundsargument would continue to be an object withminandmaxproperties, but could optionally have atarget_bucketsproperty. Specifying thetarget_bucketswould automatically calculate an intervalintervalthat 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.