blob: 2207963455aa6bcc3920df686876bbbbb8579163 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
namespace Elastica\Aggregation;
/**
* Class Percentiles.
*
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-percentile-aggregation.html
*/
class Percentiles extends AbstractSimpleAggregation
{
/**
* @param string $name the name of this aggregation
* @param string $field the field on which to perform this aggregation
*/
public function __construct($name, $field = null)
{
parent::__construct($name);
if (!is_null($field)) {
$this->setField($field);
}
}
/**
* Set compression parameter.
*
* @param float $value
*
* @return $this
*/
public function setCompression($value)
{
return $this->setParam('compression', (float) $value);
}
/**
* Set which percents must be returned.
*
* @param float[] $percents
*
* @return $this
*/
public function setPercents(array $percents)
{
return $this->setParam('percents', $percents);
}
/**
* Add yet another percent to result.
*
* @param float $percent
*
* @return $this
*/
public function addPercent($percent)
{
return $this->addParam('percents', (float) $percent);
}
}
|