Is it possible to make document_id unique among indices?

Hi,

I recently used a custom document_id to avoid duplicate in ES. However, I found that the same document can be indexed in different indices. Is there a way to make sure the document itself is unique in ES? Thank you very much.

Hey,

no, this needs to be done on the client side. Adding the index name to the id might be sufficient already there.

--Alex

Hi Alex,

Thanks for your reply. Actually I have a custom id as a combination of several fields from the log. My problem is, in the same index, the id will avoid duplicate. However, if the same message gets indexed in different indices, then two identical logs will exist. Is there a way to make sure that, with the unique id, there will only be one record in ES, among indices? Thank you so much.

--Tao

Hey,

no, there is no guarantee for that within ES.

--Alex

Hi Alex,

Thanks for your reply. Does it mean that with the default routing value (as document id), ES can only ensure the document id is unique in the same index?

--Tao

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