1 | <?php |
||
22 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-nested-aggregation.html |
||
23 | */ |
||
24 | class NestedAggregation extends AbstractAggregation |
||
25 | { |
||
26 | use BucketingTrait; |
||
27 | |||
28 | public function __construct(private string $name, private ?string $path = null) |
||
|
|||
29 | { |
||
30 | parent::__construct($name); |
||
31 | |||
32 | $this->setPath($path); |
||
33 | } |
||
34 | |||
35 | public function getPath(): ?string |
||
36 | { |
||
37 | return $this->path; |
||
38 | } |
||
39 | |||
40 | public function setPath(?string $path): static |
||
41 | { |
||
42 | $this->path = $path; |
||
43 | |||
44 | return $this; |
||
45 | } |
||
46 | |||
47 | public function getType(): string |
||
48 | { |
||
49 | return 'nested'; |
||
50 | } |
||
51 | |||
52 | public function getArray(): array |
||
53 | { |
||
54 | return ['path' => $this->getPath()]; |
||
55 | } |
||
56 | } |
||
57 |