Add CONSOLE to inner hits examples.
This commit is contained in:
parent
10874fbdf9
commit
4057682d6f
|
@ -2,8 +2,8 @@
|
||||||
=== Inner hits
|
=== Inner hits
|
||||||
|
|
||||||
The <<mapping-parent-field, parent/child>> and <<nested, nested>> features allow the return of documents that
|
The <<mapping-parent-field, parent/child>> and <<nested, nested>> 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
|
have matches in a different scope. In the parent/child case, parent documents 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
|
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.
|
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,
|
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]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
GET /_search
|
||||||
{
|
{
|
||||||
"query" : {
|
"query" : {
|
||||||
"nested" : {
|
"nested" : {
|
||||||
"path" : "comments",
|
"path" : "comments",
|
||||||
"query" : {
|
"query" : {
|
||||||
"match" : {"comments.message" : "[actual query]"}
|
"match" : {"comments.message" : "some message"}
|
||||||
},
|
},
|
||||||
"inner_hits" : {} <1>
|
"inner_hits" : {} <1>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
|
||||||
<1> The inner hit definition in the nested query. No other options need to be defined.
|
<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]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
GET /_search
|
||||||
{
|
{
|
||||||
"query" : {
|
"query" : {
|
||||||
"nested" : {
|
"nested" : {
|
||||||
"path" : "comments.votes",
|
"path" : "comments.votes",
|
||||||
"query" : { ... },
|
"query" : {
|
||||||
|
"match": { "name": "kimchy" }
|
||||||
|
},
|
||||||
"inner_hits" : {}
|
"inner_hits" : {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
|
||||||
This indirect referencing is only supported for nested inner hits.
|
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]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
GET /_search
|
||||||
{
|
{
|
||||||
"query" : {
|
"query" : {
|
||||||
"has_child" : {
|
"has_child" : {
|
||||||
"type" : "comment",
|
"type" : "comment",
|
||||||
"query" : {
|
"query" : {
|
||||||
"match" : {"message" : "[actual query]"}
|
"match" : {"message" : "some message"}
|
||||||
},
|
},
|
||||||
"inner_hits" : {} <1>
|
"inner_hits" : {} <1>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
|
||||||
<1> The inner hit definition like in the nested example.
|
<1> The inner hit definition like in the nested example.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue