diff --git a/src/Aggregation/GlobalAggregation.php b/src/Aggregation/GlobalAggregation.php index 09beb1c87f2dafe0e28c1106266f792592e3ce42..ac48255155654e00321bb3e470e0b40ae4455b07 100644 --- a/src/Aggregation/GlobalAggregation.php +++ b/src/Aggregation/GlobalAggregation.php @@ -41,6 +41,6 @@ class GlobalAggregation extends AbstractAggregation */ public function getArray() { - return []; + return new \stdClass(); } } diff --git a/src/Aggregation/ReverseNestedAggregation.php b/src/Aggregation/ReverseNestedAggregation.php index 79529610b06a2cf0c6dac10d3b4a686a65625a79..58febb5f963880e66ec93cfc39693f5a2fb51778 100644 --- a/src/Aggregation/ReverseNestedAggregation.php +++ b/src/Aggregation/ReverseNestedAggregation.php @@ -75,11 +75,11 @@ class ReverseNestedAggregation extends AbstractAggregation throw new \LogicException("Reverse Nested aggregation `{$this->getName()}` has no aggregations added"); } - $data = []; + $output = new \stdClass(); if ($this->getPath()) { - $data['path'] = $this->getPath(); + $output['path'] = $this->getPath(); } - return $data; + return $output; } } diff --git a/src/Aggregation/TopHitsAggregation.php b/src/Aggregation/TopHitsAggregation.php index 70a0ff1c090da0555ce939baec19c64ea0c76bb6..e88e99660e4f8a035c6089e38dd7c09e4c04cf72 100644 --- a/src/Aggregation/TopHitsAggregation.php +++ b/src/Aggregation/TopHitsAggregation.php @@ -138,6 +138,6 @@ class TopHitsAggregation extends AbstractAggregation $output = $this->processArray($output); - return $output; + return empty($output) ? new \stdClass() : $output; } }