Duplicate document with same _id and _type

On Fri, 2012-08-03 at 09:13 -0700, David Chancogne wrote:

We are running in the same issue as in this post, unfortunately the
thread doesn't really have any answer :frowning: :
http://elasticsearch-users.115913.n3.nabble.com/duplicate-id-type-within-the-same-index-td3530682.html

Running a search against a single index for a 'post' with a given id
we get 2 hits. We use _parent and use a
'userId' for the parent. The following result happens after trying
reassign the post to a different user and
reindex the post. Is _parent somehow used in the _uid?

A unique ID really depends on index/type/id/routing. The routing, by
default, is derived from the ID. But if you use parent-child
relationships, it is derived from the parent.

So if you change the parent and reindex, it may or may not end up on the
same shard. If it is on a different shard, then the old doc will not be
removed.

So if you're going to change the parent, you should delete the old doc
before indexing the new doc

clint