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 | $this->setPath($path); |
||
34 | } |
||
35 | |||
36 | public function getPath(): ?string |
||
37 | { |
||
38 | return $this->path; |
||
39 | } |
||
40 | |||
41 | public function setPath(?string $path): static |
||
42 | { |
||
43 | $this->path = $path; |
||
44 | |||
45 | return $this; |
||
46 | } |
||
47 | |||
48 | public function getType(): string |
||
49 | { |
||
50 | return 'reverse_nested'; |
||
51 | } |
||
52 | |||
53 | public function getArray(): stdClass|array |
||
54 | { |
||
55 | $output = new stdClass(); |
||
56 | if ($this->getPath()) { |
||
57 | $output = ['path' => $this->getPath()]; |
||
58 | } |
||
59 | |||
60 | return $output; |
||
61 | } |
||
62 | } |
||
63 |