diff --git a/src/Aggregation/Bucketing/DateRangeAggregation.php b/src/Aggregation/Bucketing/DateRangeAggregation.php index 9b68dcb4a767a77cb60917217656b5a3d56b941e..d02b3d727084b14abebe2511de0500d5c1e940e8 100644 --- a/src/Aggregation/Bucketing/DateRangeAggregation.php +++ b/src/Aggregation/Bucketing/DateRangeAggregation.php @@ -51,7 +51,8 @@ class DateRangeAggregation extends AbstractAggregation foreach ($ranges as $range) { $from = isset($range['from']) ? $range['from'] : null; $to = isset($range['to']) ? $range['to'] : null; - $this->addRange($from, $to); + $key = isset($range['key']) ? $range['key'] : null; + $this->addRange($from, $to, $key); } } @@ -78,12 +79,13 @@ class DateRangeAggregation extends AbstractAggregation * * @throws \LogicException */ - public function addRange($from = null, $to = null) + public function addRange($from = null, $to = null, $key = null) { $range = array_filter( [ 'from' => $from, 'to' => $to, + 'key' => $key, ] );