Elasticsearch possible same _id for parent-child


As I designing the elastic search for parent-child document type, I encounter this situation where my
the parent and Child database table is different.

And when I combine both into the parent child, the will be possible id conflict

Parent _id = 1 , routing = 1
Child _id= 1, routing=1

because both coming from different DB.

This will cause not able to update properly the child or parent only because the ID is the same.
Would like to seek advice on how you tackle this scenario from your experience

Currently, my option is to set the child's id with the prefix.

Parent _id = 1, routing = 1
Child _id= c_1, routing = 1

Do this work or a better solution for this?

I haven't seen what I would call a proper solution to this, for what it's worth. I think your approach is a good one.

1 Like

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