parent-field.asciidoc 964 B

123456789101112131415161718192021222324252627
  1. [[mapping-parent-field]]
  2. === `_parent`
  3. The parent field mapping is defined on a child mapping, and points to
  4. the parent type this child relates to. For example, in case of a `blog`
  5. type and a `blog_tag` type child document, the mapping for `blog_tag`
  6. should be:
  7. [source,js]
  8. --------------------------------------------------
  9. {
  10. "blog_tag" : {
  11. "_parent" : {
  12. "type" : "blog"
  13. }
  14. }
  15. }
  16. --------------------------------------------------
  17. The mapping is automatically stored and indexed (meaning it can be
  18. searched on using the `_parent` field notation).
  19. ==== Field data loading
  20. Contrary to other fields the fielddata loading is not `lazy`, but `eager`. The reason for this is that when this
  21. field has been enabled it is going to be used in parent/child queries, which heavily relies on field data to perform
  22. efficiently. This can already be observed during indexing after refresh either automatically or manually has been executed.