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]
|
||||
|
||||
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]
|
||||
--------------------------------------------------
|
||||
GET /my_index/_search
|
||||
{
|
||||
"query": {
|
||||
"parent_id" : {
|
||||
"type" : "blog_tag",
|
||||
"id" : "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
The above is functionally equivalent to using the following
|
||||
<<query-dsl-has-parent-query, `has_parent`>> query, but performs
|
||||
|
|
Loading…
Reference in New Issue