forked from ruflin/Elastica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SerialDiff.php
52 lines (44 loc) · 1.18 KB
/
SerialDiff.php
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
<?php
namespace Elastica\Aggregation;
/**
* Class SerialDiff.
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-serialdiff-aggregation.html
*/
class SerialDiff extends AbstractAggregation implements GapPolicyInterface
{
use Traits\BucketsPathTrait;
public const DEFAULT_GAP_POLICY_VALUE = GapPolicyInterface::INSERT_ZEROS;
public function __construct(string $name, string $bucketsPath)
{
parent::__construct($name);
$this->setBucketsPath($bucketsPath);
}
/**
* Set the lag for this aggregation.
*
* @return $this
*/
public function setLag(int $lag = 1): self
{
return $this->setParam('lag', $lag);
}
/**
* Set the gap policy for this aggregation.
*
* @return $this
*/
public function setGapPolicy(string $gapPolicy = self::DEFAULT_GAP_POLICY_VALUE): self
{
return $this->setParam('gap_policy', $gapPolicy);
}
/**
* Set the format for this aggregation.
*
* @return $this
*/
public function setFormat(?string $format = null): self
{
return $this->setParam('format', $format);
}
}