path = $p; return $this; } public function setQuery(Query $q): self { $this->query = $q; return $this; } public function getQuery(): ?Query { return $this->query; } public function es(): array { $nested = []; if ($this->path) { $nested['path'] = $this->path; } if ($this->query && false === $this->query->isEmpty()) { $nested['query'] = $this->query->es()['query']; } return ['nested' => $nested]; } }