| 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 | |||
| 33 | public function getPath(): ?string |
||
| 34 | { |
||
| 35 | return $this->path; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function setPath(?string $path): static |
||
| 39 | { |
||
| 40 | $this->path = $path; |
||
| 41 | |||
| 42 | return $this; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function getType(): string |
||
| 46 | { |
||
| 47 | return 'nested'; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function getArray(): array |
||
| 51 | { |
||
| 52 | return ['path' => $this->getPath()]; |
||
| 53 | } |
||
| 54 | } |
||
| 55 |