Merge pull request #18422 from MaineC/docs/add_autosense_to_query_dsl
Amended PR adding testing to query-dsl doc snippets
This commit is contained in:
commit
9cefac94d2
|
@ -3,17 +3,48 @@
|
||||||
|
|
||||||
added[5.0.0]
|
added[5.0.0]
|
||||||
|
|
||||||
The `parent_id` query can be used to find child documents which belong to a particular parent:
|
The `parent_id` query can be used to find child documents which belong to a particular parent.
|
||||||
|
Given the following mapping definition:
|
||||||
|
|
||||||
|
[source,js]
|
||||||
|
--------------------------------------------
|
||||||
|
PUT /my_index
|
||||||
|
{
|
||||||
|
"mappings": {
|
||||||
|
"blog_post": {
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "keyword"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"blog_tag": {
|
||||||
|
"_parent": {
|
||||||
|
"type": "blog_post"
|
||||||
|
},
|
||||||
|
"_routing": {
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
// TESTSETUP
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
GET /my_index/_search
|
||||||
{
|
{
|
||||||
"parent_id" : {
|
"query": {
|
||||||
"type" : "blog_tag",
|
"parent_id" : {
|
||||||
"id" : "1"
|
"type" : "blog_tag",
|
||||||
|
"id" : "1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
|
||||||
The above is functionally equivalent to using the following
|
The above is functionally equivalent to using the following
|
||||||
<<query-dsl-has-parent-query, `has_parent`>> query, but performs
|
<<query-dsl-has-parent-query, `has_parent`>> query, but performs
|
||||||
|
|
Loading…
Reference in New Issue