parent-id-query.asciidoc 807 B

12345678910111213141516171819202122232425262728293031
  1. [[query-dsl-parent-id-query]]
  2. === Parent Id Query
  3. added[5.0.0]
  4. The `parent_id` query can be used to find a child document pointing to a particular parent id.
  5. The actual underlying Lucene field that is used to store to what parent id a child document is referring to
  6. is determined by the child type's `_parent` field. This query helps by selecting the right field based
  7. on the specified child type. Example:
  8. [source,js]
  9. --------------------------------------------------
  10. {
  11. "parent_id" : {
  12. "type" : "blog_tag",
  13. "id" : "1"
  14. }
  15. }
  16. --------------------------------------------------
  17. ==== Parameters
  18. This query has two required parameters:
  19. [horizontal]
  20. `type`::
  21. The child type. This must be a type with `_parent` field.
  22. `id`::
  23. The required parent id select documents must referrer to.