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