Add another parent value option to join documentation (#25609)

Indexing a join field on a document requires a value of type "object" and two sub fields "name" 
and "parent". The "parent" field is only required on child documents, but the "name" field which 
denotes the name of the relation is always needed. Previously, only the short-hand version of the 
join field was documented. This adds documentation for the long-hand join field data, and 
explicitly points out that just specifying the name of the relation for the field value is a 
convenience shortcut.
This commit is contained in:
James Baiera 2017-07-11 15:36:59 -04:00 committed by GitHub
parent 831dbbf291
commit 847378a43b
1 changed files with 27 additions and 1 deletions

View File

@ -34,6 +34,32 @@ To index a document with a join, the name of the relation and the optional paren
of the document must be provided in the `source`.
For instance the following creates two parent documents in the `my_parent` context:
[source,js]
--------------------------------------------------
PUT my_index/doc/1?refresh
{
"text": "This is a parent document",
"my_join_field": {
"name": "my_parent" <1>
}
}
PUT my_index/doc/2?refresh
{
"text": "This is a another parent document",
"my_join_field": {
"name": "my_parent"
}
}
--------------------------------------------------
// CONSOLE
// TEST[continued]
<1> This document is a `my_parent` document.
When indexing parent documents, you can choose to specify just the name of the relation
as a shortcut instead of encapsulating it in the normal object notation:
[source,js]
--------------------------------------------------
PUT my_index/doc/1?refresh
@ -51,7 +77,7 @@ PUT my_index/doc/2?refresh
// CONSOLE
// TEST[continued]
<1> This document is a `my_parent` document.
<1> Simpler notation for a parent document just uses the relation name.
When indexing a child, the name of the relation as well as the parent id of the document
must be added in the `_source`.