31 lines
807 B
Plaintext
31 lines
807 B
Plaintext
|
[[query-dsl-parent-id-query]]
|
||
|
=== Parent Id Query
|
||
|
|
||
|
added[3.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:
|
||
|
|
||
|
[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.
|