1 | <?php |
||
22 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-missing-aggregation.html |
||
23 | */ |
||
24 | class MissingAggregation extends AbstractAggregation |
||
25 | { |
||
26 | use BucketingTrait; |
||
27 | |||
28 | public function __construct(private string $name, private ?string $field = null) |
||
|
|||
29 | { |
||
30 | parent::__construct($name); |
||
31 | } |
||
32 | |||
33 | public function getArray(): array |
||
34 | { |
||
35 | if ($this->getField()) { |
||
36 | return ['field' => $this->getField()]; |
||
37 | } |
||
38 | |||
39 | throw new \LogicException('Missing aggregation must have a field set.'); |
||
40 | } |
||
41 | |||
42 | public function getType(): string |
||
43 | { |
||
44 | return 'missing'; |
||
45 | } |
||
46 | } |
||
47 |