Skip to content

How to get results of inner hits in ongr? #808

Closed
@demianchuk

Description

@demianchuk

Hi,

I have next simple exaple
$manager = $this->get('es.manager.user_index.auction_document');
$search = $manager->createSearch();
$hasParentQuery = new HasParentQuery(
'user_document',
new MatchAllQuery(),
["inner_hits" => new MatchAllQuery()]
);
$search->addQuery($hasParentQuery);
$result = $manager->execute($search);
dump($result);
die;

That gives me inner hits with query results.

DocumentIterator {#681
-aggregations: null
#documents: array:4 [▼
0 => array:8 [▼
"_index" => "user_index"
"_type" => "auction_document"
"_id" => "1847622"
"_score" => 1.0
"_parent" => "53247"
"_routing" => "53247"
"_source" => array:43 [▶]
"inner_hits" => array:1 [▼
"user_document" => array:1 [▶]
]
]
1 => array:8 [▶]
2 => array:8 [▶]
3 => array:8 [▶]
]
-count: 4
-converter: Converter {#205 ▶}
-manager: Manager {#840 ▶}
-managerConfig: array:6 [▶]
-scrollId: null
-scrollDuration: null
-key: 0
-aggregations: []
}

How can I get inner hits? Don't see any getter neither on result search object neither on document object
Does it exist?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions