path = $path; if ($query === NULL) { $query = new \Spameri\ElasticQuery\Query\QueryCollection(); } $this->query = $query; } public function key(): string { return 'nested_' . $this->path; } public function toArray(): array { return [ 'nested' => [ 'path' => $this->path, 'query' => [ 'bool' => $this->query->toArray(), ], ], ]; } public function getQuery(): \Spameri\ElasticQuery\Query\QueryCollection { return $this->query; } }