diff --git a/src/Aggregation/Pipeline/AbstractPipelineAggregation.php b/src/Aggregation/Pipeline/AbstractPipelineAggregation.php new file mode 100644 index 0000000000000000000000000000000000000000..5fe680dfea33596025c7d2698ae25126ce2005d0 --- /dev/null +++ b/src/Aggregation/Pipeline/AbstractPipelineAggregation.php @@ -0,0 +1,50 @@ +<?php + +namespace ONGR\ElasticsearchDSL\Aggregation\Pipeline; + +use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation; +use ONGR\ElasticsearchDSL\Aggregation\Type\MetricTrait; + +abstract class AbstractPipelineAggregation extends AbstractAggregation +{ + use MetricTrait; + + /** + * @var string + */ + private $bucketsPath; + + /** + * @param string $name + * @param $bucketsPath + */ + public function __construct($name, $bucketsPath) + { + parent::__construct($name); + $this->setBucketsPath($bucketsPath); + } + + /** + * @return string + */ + public function getBucketsPath() + { + return $this->bucketsPath; + } + + /** + * @param string $bucketsPath + */ + public function setBucketsPath($bucketsPath) + { + $this->bucketsPath = $bucketsPath; + } + + /** + * {@inheritdoc} + */ + public function getArray() + { + return ['buckets_path' => $this->getBucketsPath()]; + } +}