2013-08-28 19:24:34 -04:00
|
|
|
[[mapping-parent-field]]
|
|
|
|
=== `_parent`
|
|
|
|
|
|
|
|
The parent field mapping is defined on a child mapping, and points to
|
|
|
|
the parent type this child relates to. For example, in case of a `blog`
|
|
|
|
type and a `blog_tag` type child document, the mapping for `blog_tag`
|
|
|
|
should be:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"blog_tag" : {
|
|
|
|
"_parent" : {
|
|
|
|
"type" : "blog"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
The mapping is automatically stored and indexed (meaning it can be
|
|
|
|
searched on using the `_parent` field notation).
|
2015-02-22 17:15:37 -05:00
|
|
|
|
|
|
|
==== Field data loading
|
|
|
|
|
|
|
|
Contrary to other fields the fielddata loading is not `lazy`, but `eager`. The reason for this is that when this
|
|
|
|
field has been enabled it is going to be used in parent/child queries, which heavily relies on field data to perform
|
|
|
|
efficiently. This can already be observed during indexing after refresh either automatically or manually has been executed.
|