From d49404c2fb28d2273661e5254d20c2b3b613e51e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Marcinkevi=C4=8Dius?= <marc.mantas@gmail.com> Date: Mon, 29 Aug 2016 11:47:52 +0300 Subject: [PATCH] added percentiles aggregation --- .../Pipeline/PercentilesBucketAggregation.php | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/Aggregation/Pipeline/PercentilesBucketAggregation.php diff --git a/src/Aggregation/Pipeline/PercentilesBucketAggregation.php b/src/Aggregation/Pipeline/PercentilesBucketAggregation.php new file mode 100644 index 0000000..d74b88f --- /dev/null +++ b/src/Aggregation/Pipeline/PercentilesBucketAggregation.php @@ -0,0 +1,63 @@ +<?php + +/* + * This file is part of the ONGR package. + * + * (c) NFQ Technologies UAB <info@nfq.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ElasticsearchDSL\Aggregation\Pipeline; + +/** + * Class representing Percentiles Bucket Pipeline Aggregation. + * + * @link https://goo.gl/bqi7m5 + */ +class PercentilesBucketAggregation extends AbstractPipelineAggregation +{ + /** + * @var array + */ + private $percents; + + /** + * {@inheritdoc} + */ + public function getType() + { + return 'percentiles_bucket'; + } + + /** + * @return array + */ + public function getPercents() + { + return $this->percents; + } + + /** + * @param array $percents + */ + public function setPercents(array $percents) + { + $this->percents = $percents; + } + + /** + * {@inheritdoc} + */ + public function getArray() + { + $data = ['buckets_path' => $this->getBucketsPath()]; + + if ($this->getPercents()) { + $data['percents'] = $this->getPercents(); + } + + return $data; + } +} -- GitLab