@@ 12-76 (lines=65) @@ | ||
9 | * |
|
10 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-avg-bucket-aggregation.html |
|
11 | */ |
|
12 | class AvgBucket extends AbstractAggregation |
|
13 | { |
|
14 | /** |
|
15 | * @param string $name |
|
16 | * @param string|null $bucketsPath |
|
17 | */ |
|
18 | public function __construct($name, $bucketsPath = null) |
|
19 | { |
|
20 | parent::__construct($name); |
|
21 | ||
22 | if (null !== $bucketsPath) { |
|
23 | $this->setBucketsPath($bucketsPath); |
|
24 | } |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * Set the buckets_path for this aggregation. |
|
29 | * |
|
30 | * @param string $bucketsPath |
|
31 | * |
|
32 | * @return $this |
|
33 | */ |
|
34 | public function setBucketsPath($bucketsPath) |
|
35 | { |
|
36 | return $this->setParam('buckets_path', $bucketsPath); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * Set the gap policy for this aggregation. |
|
41 | * |
|
42 | * @param string $gapPolicy |
|
43 | * |
|
44 | * @return $this |
|
45 | */ |
|
46 | public function setGapPolicy($gapPolicy) |
|
47 | { |
|
48 | return $this->setParam('gap_policy', $gapPolicy); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * Set the format for this aggregation. |
|
53 | * |
|
54 | * @param string $format |
|
55 | * |
|
56 | * @return $this |
|
57 | */ |
|
58 | public function setFormat($format) |
|
59 | { |
|
60 | return $this->setParam('format', $format); |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * @throws InvalidException If buckets path or script is not set |
|
65 | * |
|
66 | * @return array |
|
67 | */ |
|
68 | public function toArray() |
|
69 | { |
|
70 | if (!$this->hasParam('buckets_path')) { |
|
71 | throw new InvalidException('Buckets path is required'); |
|
72 | } |
|
73 | ||
74 | return parent::toArray(); |
|
75 | } |
|
76 | } |
|
77 |
@@ 12-76 (lines=65) @@ | ||
9 | * |
|
10 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-derivative-aggregation.html |
|
11 | */ |
|
12 | class Derivative extends AbstractAggregation |
|
13 | { |
|
14 | /** |
|
15 | * @param string $name |
|
16 | * @param string|null $bucketsPath |
|
17 | */ |
|
18 | public function __construct(string $name, string $bucketsPath = null) |
|
19 | { |
|
20 | parent::__construct($name); |
|
21 | ||
22 | if (null !== $bucketsPath) { |
|
23 | $this->setBucketsPath($bucketsPath); |
|
24 | } |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * Set the buckets_path for this aggregation. |
|
29 | * |
|
30 | * @param string $bucketsPath |
|
31 | * |
|
32 | * @return $this |
|
33 | */ |
|
34 | public function setBucketsPath(string $bucketsPath) |
|
35 | { |
|
36 | return $this->setParam('buckets_path', $bucketsPath); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * Set the gap policy for this aggregation. |
|
41 | * |
|
42 | * @param string $gapPolicy |
|
43 | * |
|
44 | * @return $this |
|
45 | */ |
|
46 | public function setGapPolicy(string $gapPolicy = 'skip') |
|
47 | { |
|
48 | return $this->setParam('gap_policy', $gapPolicy); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * Set the format for this aggregation. |
|
53 | * |
|
54 | * @param string $format |
|
55 | * |
|
56 | * @return $this |
|
57 | */ |
|
58 | public function setFormat(string $format) |
|
59 | { |
|
60 | return $this->setParam('format', $format); |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * @throws InvalidException If buckets path or script is not set |
|
65 | * |
|
66 | * @return array |
|
67 | */ |
|
68 | public function toArray(): array |
|
69 | { |
|
70 | if (!$this->hasParam('buckets_path')) { |
|
71 | throw new InvalidException('Buckets path is required'); |
|
72 | } |
|
73 | ||
74 | return parent::toArray(); |
|
75 | } |
|
76 | } |
|
77 |
@@ 12-88 (lines=77) @@ | ||
9 | * |
|
10 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-serialdiff-aggregation.html |
|
11 | */ |
|
12 | class SerialDiff extends AbstractAggregation |
|
13 | { |
|
14 | /** |
|
15 | * @param string $name |
|
16 | * @param string|null $bucketsPath |
|
17 | */ |
|
18 | public function __construct($name, $bucketsPath = null) |
|
19 | { |
|
20 | parent::__construct($name); |
|
21 | ||
22 | if (null !== $bucketsPath) { |
|
23 | $this->setBucketsPath($bucketsPath); |
|
24 | } |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * Set the buckets_path for this aggregation. |
|
29 | * |
|
30 | * @param string $bucketsPath |
|
31 | * |
|
32 | * @return $this |
|
33 | */ |
|
34 | public function setBucketsPath($bucketsPath) |
|
35 | { |
|
36 | return $this->setParam('buckets_path', $bucketsPath); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * Set the lag for this aggregation. |
|
41 | * |
|
42 | * @param int $lag |
|
43 | * |
|
44 | * @return $this |
|
45 | */ |
|
46 | public function setLag($lag) |
|
47 | { |
|
48 | return $this->setParam('lag', $lag); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * Set the gap policy for this aggregation. |
|
53 | * |
|
54 | * @param string $gapPolicy |
|
55 | * |
|
56 | * @return $this |
|
57 | */ |
|
58 | public function setGapPolicy($gapPolicy) |
|
59 | { |
|
60 | return $this->setParam('gap_policy', $gapPolicy); |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * Set the format for this aggregation. |
|
65 | * |
|
66 | * @param string $format |
|
67 | * |
|
68 | * @return $this |
|
69 | */ |
|
70 | public function setFormat($format) |
|
71 | { |
|
72 | return $this->setParam('format', $format); |
|
73 | } |
|
74 | ||
75 | /** |
|
76 | * @throws InvalidException If buckets path is not set |
|
77 | * |
|
78 | * @return array |
|
79 | */ |
|
80 | public function toArray() |
|
81 | { |
|
82 | if (!$this->hasParam('buckets_path')) { |
|
83 | throw new InvalidException('Buckets path is required'); |
|
84 | } |
|
85 | ||
86 | return parent::toArray(); |
|
87 | } |
|
88 | } |
|
89 |
@@ 12-76 (lines=65) @@ | ||
9 | * |
|
10 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-stats-bucket-aggregation.html |
|
11 | */ |
|
12 | class StatsBucket extends AbstractAggregation |
|
13 | { |
|
14 | /** |
|
15 | * @param string $name |
|
16 | * @param string|null $bucketsPath |
|
17 | */ |
|
18 | public function __construct($name, $bucketsPath = null) |
|
19 | { |
|
20 | parent::__construct($name); |
|
21 | ||
22 | if (null !== $bucketsPath) { |
|
23 | $this->setBucketsPath($bucketsPath); |
|
24 | } |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * Set the buckets_path for this aggregation. |
|
29 | * |
|
30 | * @param string $bucketsPath |
|
31 | * |
|
32 | * @return $this |
|
33 | */ |
|
34 | public function setBucketsPath($bucketsPath) |
|
35 | { |
|
36 | return $this->setParam('buckets_path', $bucketsPath); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * Set the gap policy for this aggregation. |
|
41 | * |
|
42 | * @param string $gapPolicy |
|
43 | * |
|
44 | * @return $this |
|
45 | */ |
|
46 | public function setGapPolicy($gapPolicy) |
|
47 | { |
|
48 | return $this->setParam('gap_policy', $gapPolicy); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * Set the format for this aggregation. |
|
53 | * |
|
54 | * @param string $format |
|
55 | * |
|
56 | * @return $this |
|
57 | */ |
|
58 | public function setFormat($format) |
|
59 | { |
|
60 | return $this->setParam('format', $format); |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * @throws InvalidException If buckets path or script is not set |
|
65 | * |
|
66 | * @return array |
|
67 | */ |
|
68 | public function toArray() |
|
69 | { |
|
70 | if (!$this->hasParam('buckets_path')) { |
|
71 | throw new InvalidException('Buckets path is required'); |
|
72 | } |
|
73 | ||
74 | return parent::toArray(); |
|
75 | } |
|
76 | } |
|
77 |
@@ 12-76 (lines=65) @@ | ||
9 | * |
|
10 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-sum-bucket-aggregation.html |
|
11 | */ |
|
12 | class SumBucket extends AbstractAggregation |
|
13 | { |
|
14 | /** |
|
15 | * @param string $name |
|
16 | * @param string|null $bucketsPath |
|
17 | */ |
|
18 | public function __construct($name, $bucketsPath = null) |
|
19 | { |
|
20 | parent::__construct($name); |
|
21 | ||
22 | if (null !== $bucketsPath) { |
|
23 | $this->setBucketsPath($bucketsPath); |
|
24 | } |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * Set the buckets_path for this aggregation. |
|
29 | * |
|
30 | * @param string $bucketsPath |
|
31 | * |
|
32 | * @return $this |
|
33 | */ |
|
34 | public function setBucketsPath($bucketsPath) |
|
35 | { |
|
36 | return $this->setParam('buckets_path', $bucketsPath); |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * Set the gap policy for this aggregation. |
|
41 | * |
|
42 | * @param string $gapPolicy |
|
43 | * |
|
44 | * @return $this |
|
45 | */ |
|
46 | public function setGapPolicy($gapPolicy) |
|
47 | { |
|
48 | return $this->setParam('gap_policy', $gapPolicy); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * Set the format for this aggregation. |
|
53 | * |
|
54 | * @param string $format |
|
55 | * |
|
56 | * @return $this |
|
57 | */ |
|
58 | public function setFormat($format) |
|
59 | { |
|
60 | return $this->setParam('format', $format); |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * @throws InvalidException If buckets path or script is not set |
|
65 | * |
|
66 | * @return array |
|
67 | */ |
|
68 | public function toArray() |
|
69 | { |
|
70 | if (!$this->hasParam('buckets_path')) { |
|
71 | throw new InvalidException('Buckets path is required'); |
|
72 | } |
|
73 | ||
74 | return parent::toArray(); |
|
75 | } |
|
76 | } |
|
77 |