-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Description
Related to #15613
Types are going to be removed. The parent/child is tightly coupled to types, so that needs to be changed. Parent/child still needs to distinguish between a parent or a child document, so the idea is that a new meta field type name _join
will be allow that. This new field would replace _parent
meta field. Each _join
meta field type would maintain an indexed field to distinguish between parent and child documents and a doc values field needed for the join operation.
Example of how to use typeless parent/child:
PUT /stackoverflow
{
"mapping": {
"_join": ["question-to-answers"]
}
}
}
Indexing question document (parent):
PUT stackoverflow/1?join=question-to-answers
{
"question" : "..."
}
Indexing answer document (child):
PUT stackoverflow/2?join=question-to-answers&parent=1
{
"answer" : "..."
}
Besides the parent
the typeless parent/child will also need a join
url parameter. In order to prevent adding more feature specific options to transport and rest layer, meta fields should be completely isolated, from rest to mapping layer. This will result in cleaner code and allows parent/child to be moved to a module.
Adding answer-to-comments
join field:
PUT /index1
{
"mapping": {
"_join": ["question-to-answers", "answer-to-comments"]
}
}
}
Indexing question document (parent):
PUT stackoverflow/1?join=question-to-answers
{
"question" : "..."
}
Indexing answer document (child):
PUT stackoverflow/2?join=question-to-answers,answer-to-comments&parent=1
{
"answer" : "..."
}
Indexing comment document (grand child):
PUT stackoverflow/3?join=answer-to-comments&parent=2&routing=1
{
"comment" : "..."
}