Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
demianchuk opened this issue Aug 4, 2017 · 1 comment
Closed

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

demianchuk opened this issue Aug 4, 2017 · 1 comment

Comments

@demianchuk
Copy link
Contributor

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?

@saimaz
Copy link
Contributor

saimaz commented Mar 21, 2019

Inner hits you can get through the raw iterator. It is too complicated to convert them to the objective representation. Not sure if I will ever add inner hits support to the DocumentIterator.

@saimaz saimaz closed this as completed Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants