Skip to content

Commit

Permalink
fix: include doc ID for child docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Taylor-Jackson committed Jan 12, 2018
1 parent 2557ea8 commit 563f1dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/DesignMyNight/Elasticsearch/QueryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ protected function documentFromResult(Builder $query, array $result): array
protected function addInnerHitsToDocument($document, $innerHits): array
{
foreach ($innerHits as $documentType => $hitResults){
$document['inner_hits'][$documentType] = array_column($hitResults['hits']['hits'], '_source');
foreach ( $hitResults['hits']['hits'] as $result ){
$document['inner_hits'][$documentType][] = array_merge(['_id' => $result['_id']], $result['_source']);
}
}

return $document;
Expand Down

0 comments on commit 563f1dd

Please sign in to comment.