diff --git a/docs/reference/search/request/inner-hits.asciidoc b/docs/reference/search/request/inner-hits.asciidoc index 7fe200292a9..75756d4df86 100644 --- a/docs/reference/search/request/inner-hits.asciidoc +++ b/docs/reference/search/request/inner-hits.asciidoc @@ -2,8 +2,8 @@ === Inner hits The <> and <> features allow the return of documents that -have matches in a different scope. In the parent/child case, parent document are returned based on matches in child -documents or child document are returned based on matches in parent documents. In the nested case, documents are returned +have matches in a different scope. In the parent/child case, parent documents are returned based on matches in child +documents or child documents are returned based on matches in parent documents. In the nested case, documents are returned based on matches in nested inner objects. In both cases, the actual matches in the different scopes that caused a document to be returned is hidden. In many cases, @@ -84,18 +84,20 @@ The example below assumes that there is a nested object field defined with the n [source,js] -------------------------------------------------- +GET /_search { "query" : { "nested" : { "path" : "comments", "query" : { - "match" : {"comments.message" : "[actual query]"} + "match" : {"comments.message" : "some message"} }, "inner_hits" : {} <1> } } } -------------------------------------------------- +// CONSOLE <1> The inner hit definition in the nested query. No other options need to be defined. @@ -159,16 +161,20 @@ with the root hits then the following path can be defined: [source,js] -------------------------------------------------- +GET /_search { "query" : { "nested" : { "path" : "comments.votes", - "query" : { ... }, + "query" : { + "match": { "name": "kimchy" } + }, "inner_hits" : {} } } } -------------------------------------------------- +// CONSOLE This indirect referencing is only supported for nested inner hits. @@ -181,18 +187,20 @@ The examples below assumes that there is a `_parent` field mapping in the `comme [source,js] -------------------------------------------------- +GET /_search { "query" : { "has_child" : { "type" : "comment", "query" : { - "match" : {"message" : "[actual query]"} + "match" : {"message" : "some message"} }, "inner_hits" : {} <1> } } } -------------------------------------------------- +// CONSOLE <1> The inner hit definition like in the nested example. @@ -226,4 +234,4 @@ An example of a response snippet that could be generated from the above search r } }, ... --------------------------------------------------- \ No newline at end of file +--------------------------------------------------