From 1ce05327e43c1448f003c5102c648fd9aca8a2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Marcinkevi=C4=8Dius?= <marc.mantas@gmail.com> Date: Mon, 29 Aug 2016 10:03:12 +0300 Subject: [PATCH] added the general pipeline agg logic to the abstraction --- .../Pipeline/AbstractPipelineAggregation.php | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/Aggregation/Pipeline/AbstractPipelineAggregation.php b/src/Aggregation/Pipeline/AbstractPipelineAggregation.php index 8e20253..5fe680d 100644 --- a/src/Aggregation/Pipeline/AbstractPipelineAggregation.php +++ b/src/Aggregation/Pipeline/AbstractPipelineAggregation.php @@ -3,8 +3,48 @@ namespace ONGR\ElasticsearchDSL\Aggregation\Pipeline; use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation; +use ONGR\ElasticsearchDSL\Aggregation\Type\MetricTrait; abstract class AbstractPipelineAggregation extends AbstractAggregation { + use MetricTrait; -} \ No newline at end of file + /** + * @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()]; + } +} -- GitLab