Can we have Multiple Parent - Single Child Relation in elastic search


(Sharon AS) #1

Hi @dadoonet and All,

Please help me on below.

On a long search, I have found in elastic search(I am using V6.5.4) we have the option for Single Parent - Multiple Children mapping.

//Code Start
PUT my_index124
{
"mappings": {
"_doc": {
"properties": {
"my_join_field": {
"type": "join",
"relations": {
"question": ["answer", "comment"]
}
}
}
}
}
}
//Code End

My question is : Do we have a reverse option - Multiple Parent - Single Child.

I have some static data for example School, Teacher, ClassRoom, BloodGroup etc.
And we need to use these in the child - student data.
Initially, I created index like for each student document added all these data in the same document. But some classroom names changed. Now updating all students with respective class will be a big task.

This type of name changes will happen in the future also. I think if we have multiple parents - single child relation, we can set all static items as parent and we can use ids of these in child and updating names will be easy.

Please advise on this.

Regards,
Sharon A S


(Christian Dahlqvist) #2

No, that is not possible. I would recommend looking into denormalizing and storing the data with each parent.


(David Pilato) #3

Welcome to this forum. Please don't ping people who are not yet part of the discussion. Thanks.


(Sharon AS) #4

OK @dadoonet, I found many of your comments on related topics. That is why I added your name.

Could you please add your comments here, are you agree with [Christian_Dahlqvist]


(system) closed #5

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