Docs: Clarified the purpose of the parent_id query
This commit is contained in:
parent
c22d93f7cc
commit
acec464eb8
|
@ -3,19 +3,33 @@
|
|||
|
||||
added[5.0.0]
|
||||
|
||||
The `parent_id` query can be used to find a child document pointing to a particular parent id.
|
||||
|
||||
The actual underlying Lucene field that is used to store to what parent id a child document is referring to
|
||||
is determined by the child type's `_parent` field. This query helps by selecting the right field based
|
||||
on the specified child type. Example:
|
||||
The `parent_id` query can be used to find child documents which belong to a particular parent:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"parent_id" : {
|
||||
"type" : "blog_tag",
|
||||
"id" : "1"
|
||||
"parent_id" : {
|
||||
"type" : "blog_tag",
|
||||
"id" : "1"
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
|
||||
The above is functionally equivalent to using the following
|
||||
<<query-dsl-has-parent-query, `has_parent`>> query, but performs
|
||||
better as it does not need to do a join:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"has_parent": {
|
||||
"type": "blog",
|
||||
"query": {
|
||||
"term": {
|
||||
"_id": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
|
||||
|
@ -24,8 +38,6 @@ on the specified child type. Example:
|
|||
This query has two required parameters:
|
||||
|
||||
[horizontal]
|
||||
`type`::
|
||||
The child type. This must be a type with `_parent` field.
|
||||
`type`:: The **child** type. This must be a type with `_parent` field.
|
||||
|
||||
`id`::
|
||||
The required parent id select documents must referrer to.
|
||||
`id`:: The required parent id select documents must referrer to.
|
Loading…
Reference in New Issue