diff --git a/src/QueryProcessor.php b/src/QueryProcessor.php index adcee66..6c25308 100644 --- a/src/QueryProcessor.php +++ b/src/QueryProcessor.php @@ -47,6 +47,10 @@ public function documentFromResult(Builder $query, array $result): array $document = $result['_source']; $document['_id'] = $result['_id']; + if (! empty($result['_parent'])) { + $document['_parent'] = $result['_parent']; + } + if ($query->includeInnerHits && isset($result['inner_hits'])) { $document = $this->addInnerHitsToDocument($document, $result['inner_hits']); }