diff --git a/src/Aggregation/NestedAggregation.php b/src/Aggregation/NestedAggregation.php index f3ace96516ef1ed12467a2f258ca0749b5db9049..be5da0bed1b82e1b807400d63663ee4cf8f97f2e 100644 --- a/src/Aggregation/NestedAggregation.php +++ b/src/Aggregation/NestedAggregation.php @@ -71,10 +71,6 @@ class NestedAggregation extends AbstractAggregation */ public function getArray() { - if (count($this->getAggregations()) == 0) { - throw new \LogicException("Nested aggregation `{$this->getName()}` has no aggregations added"); - } - return ['path' => $this->getPath()]; } } diff --git a/tests/Aggregation/NestedAggregationTest.php b/tests/Aggregation/NestedAggregationTest.php index 437823fcc2ea127441de1b649a575875a14c6cbf..874c299857ab75440eac142d956bc2a42dcff568 100644 --- a/tests/Aggregation/NestedAggregationTest.php +++ b/tests/Aggregation/NestedAggregationTest.php @@ -16,18 +16,6 @@ use ONGR\ElasticsearchDSL\Aggregation\TermsAggregation; class NestedAggregationTest extends \PHPUnit_Framework_TestCase { - /** - * Test for nested aggregation toArray() method exception. - * - * @expectedException \LogicException - */ - public function testToArrayException() - { - $aggregation = new NestedAggregation('test_agg'); - $aggregation->setPath('test_path'); - $aggregation->toArray(); - } - /** * Test for nested aggregation toArray() method exception. */