Unique IDs on joinType data structures

As suggests in this issue: Possible to index duplicate documents with same id and routing id. · Issue #31976 · elastic/elasticsearch · GitHub

I want to start a discussion about the problem described in Possible to index duplicate documents with same id and routing id. · Issue #31976 · elastic/elasticsearch · GitHub

Given a parent-child relation over the joinType data structure:
If two "parent" documents get placed on different shards, one can add the same "child" to both of the documents. But if the calculated hash results in those two documents to be places on the same shard, it wouldn't be possible. This is not a consistent behavior.

So the question is, how can I have a constraint on unique IDs without issuing a search request which checks if a document already exists before adding a new child document?

Background information: We have a frontend where customers can add child documents to existing parent documents, but the same child document is only allowed to be added once thus we can't make sure the document with the same ID always get's the same routing key as suggested in the github issue answer:

You need to ensure that if you use routing values two documents with the same id cannot have different routing keys

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