Hey,
After reading a lot, looks like there is no support for multi parent documents in elasticsearch.
It maybe indicate wrong modeling of my documents.
The thing is I am not sure what or how I can handle this use case which used to be easy in a relational database by using a foreign key.
I have the following documents:
doc1:
{
_id: 10
"source":{
"first_name": "child1_first_name",
"last_name": "child1_last_name",
"age" : 10,
"phone": "0505055050",
.
.
"mother":{
"id": 100
"firt_name": "mother1",
"last_name": "last_name1"
}
}
}
doc2:
{
_id: 11
"source":{
"first_name": "child2_first_name",
"last_name": "child2_last_name",
"age" : 12,
"phone": "878787878",
.
.
"mother":{
"id": 100
"firt_name": "mother1",
"last_name": "last_name1"
}
}
}
doc3:
{
_id: 100
"source":{
"first_name": "mother1",
"last_name": "last_name1",
"age" : 40,
"phone": "12212121212",
.
.
"mother":{}
}
}
The above documents have only one mother and it can be a potential parent document,
but it can also have a father.
My problem is what to do when the mother or father update their first name?
How does the children document will get this information?
Should I, on a change, iterate on the relevant children and update them?
Or there is a more elegant way?