How to use parent child relationships between types residing in different index in ElasticSearch 6.5

Hi,

I am trying to migrate from ES 5.x to 6.5 and I am stuck at migrating mappings of parent child relationships. Right now in ES 5 I have all the types in one index but the ES6.5 does not support multiple types in same index. So I am thinking to have one type per index. But the problem is I don't know how I can create parent child relationship using new join type when the types exist in two different index. For example 'parent' type exist in 'es_001' index while 'child' type exist in 'es_002' index.

Any help in this regard is greatly appreciated.

Regards,
Akash

Documents within a parent-child hierarchy still need to be located within the same index and shard. As long as the mappings do not conflict, store all types in a single index under the a single type. If you need to be able to filter by type you can add a custom field that contains the type name to support that.

Thanks Christian. I was able to create parent child relationship in single index as you explained.

I have one more problem with LogStash as to how to populate parent and child. My mapping is something like below :

{
"mappings": {
"_doc": {
"properties": {
"my_join_field": {
"type": "join",
"relations": {
"parent": "child"
}
},
"parent": {
"title": { "type": "text" },
"gender": { "type": "text" },
"hair_color": { "type": "text" }
},
"child": {
"title": { "type": "text" },
"id_details": {"type": "nested",
"properties": {
"id_title": {"type": "text"},
"id_num": {"type": "keyword"}
}
}
}
}
}
}
}

And I am having difficulty as to how to use filter plugin to index specific type. Because the document type is the "_doc", I have no way to index the data into specific type for example in above mapping the "parent" and "child" type.

Any help is greatly appreciated.

Regards,
Akash

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.