Multiple documents with the same _id


(David Smith-2) #1

We're using elasticsearch 1.4.0 and we index documents using bulk indexing from node client.

We seem to be getting quite a few duplicates as elasticsearch doesn't seem to recognize that there are already documents with the same _id.

GET /searchables/_search
{
    "from": 0,
    "size": 100,
    "query": {
      "ids": {
        "values": ["7373180"]
      }
    
   },
   "_source": "false", 
   "fielddata_fields": [ "_timestamp"]
}


{
   "took": 299,
   "timed_out": false,
   "_shards": {
      "total": 8,
      "successful": 8,
      "failed": 0
   },
   "hits": {
      "total": 2,
      "max_score": 1,
      "hits": [
         {
            "_index": "searchables-1426610789546",
            "_type": "user",
            "_id": "7373180",
            "_score": 1,
            "fields": {
               "_timestamp": 1432446458000
            }
         },
         {
            "_index": "searchables-1426610789546",
            "_type": "user",
            "_id": "7373180",
            "_score": 1,
            "fields": {
               "_timestamp": 1426612089000
            }
         }
      ]
   }
}

(Mark Walkom) #2

(Not sure what I was reading before, but I was wrong :frowning: )


(Meidan) #3

How did you index it? If you used manual routing, you might have routed each document to a different shard.


(David Smith-2) #4

I did use manual routing, but the same routing value was used both times.


(system) #5