Skip to content
Snippets Groups Projects
Commit 326016f8 authored by Mantas Marcinkevičius's avatar Mantas Marcinkevičius Committed by Simonas Šerlinskas
Browse files

added docs for parent inner hit

parent 1e90f9a8
No related branches found
No related tags found
No related merge requests found
# Parent Inner Hits
> More info about inner hits is in the [official elasticsearch docs][1]
The `parent/child` inner_hits can be used to include parent or child.
The usage of parent inner hits is very similar to that of nested [inner hits](Nested.md), the only
difference is that in stead of passing the `path` to the nested object, the parent/child `type`
needs to be passed to the `$path` variable.
## Simple example
```JSON
{
"inner_hits" : {
"children" : {
"type" : {
"article" : {
"query" : {
"match" : {"title" : "[actual query]"}
}
}
}
}
}
}
```
And now the query via DSL:
```php
$matchQuery = new MatchQuery('title', '[actual query]');
$innerHit = new ParentInnerHit('children', 'article', $matchQuery);
$search = new Search();
$search->addInnerHit($innerHit);
$search->toArray();
```
[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment