2016-01-17 16:49:07 -05:00
|
|
|
[[query-dsl-parent-id-query]]
|
|
|
|
=== Parent Id Query
|
|
|
|
|
2016-02-29 10:21:39 -05:00
|
|
|
added[5.0.0]
|
2016-01-17 16:49:07 -05:00
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"parent_id" : {
|
|
|
|
"type" : "blog_tag",
|
|
|
|
"id" : "1"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
==== Parameters
|
|
|
|
|
|
|
|
This query has two required parameters:
|
|
|
|
|
|
|
|
[horizontal]
|
|
|
|
`type`::
|
|
|
|
The child type. This must be a type with `_parent` field.
|
|
|
|
|
|
|
|
`id`::
|
|
|
|
The required parent id select documents must referrer to.
|