We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 55b4925 commit 90b0feeCopy full SHA for 90b0fee
src/Aggregation/Avg.php
@@ -0,0 +1,37 @@
1
+<?php declare(strict_types = 1);
2
+
3
+namespace Spameri\ElasticQuery\Aggregation;
4
5
+/**
6
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-avg-aggregation.html
7
+ */
8
+class Avg implements \Spameri\ElasticQuery\Aggregation\LeafAggregationInterface
9
+{
10
11
+ private string $field;
12
13
14
+ public function __construct(
15
+ string $field
16
+ )
17
+ {
18
+ $this->field = $field;
19
+ }
20
21
22
+ public function key(): string
23
24
+ return 'avg_' . $this->field;
25
26
27
28
+ public function toArray(): array
29
30
+ return [
31
+ 'avg' => [
32
+ 'field' => $this->field,
33
+ ],
34
+ ];
35
36
37
+}
0 commit comments