query = $query;
}
public function key(): string
{
return 'nested_' . $this->path;
}
/**
* @return array>
*/
public function toArray(): array
{
$queryArray = $this->query->toArray();
if (\count($queryArray) === 0) {
$queryArray = ['bool' => new \stdClass()];
}
$body = [
'path' => $this->path,
'query' => $queryArray,
];
if ($this->scoreMode !== null) {
$body['score_mode'] = $this->scoreMode;
}
if ($this->ignoreUnmapped !== null) {
$body['ignore_unmapped'] = $this->ignoreUnmapped;
}
if ($this->innerHits !== null) {
$body['inner_hits'] = $this->innerHits->toArray();
}
return [
'nested' => $body,
];
}
public function getQuery(): \Spameri\ElasticQuery\Query\QueryCollection
{
return $this->query;
}
}