My index settings:
{
"aliases": {
"alias_test_read": {}
},
"mappings": {
"_routing": {
"required": true
},
"properties": {
"id": {
"type": "text",
"store": true
},
"name": {
"type": "text",
"store": true
},
"type": {
"type": "text",
"store": true
}
}
},
"settings": {
"index": {
"number_of_shards": "3",
"number_of_replicas": "1"
}
}
}
inserting the recodes using the bulk API:
curl -xpost http://host:port/test/_bulk
{"index":{"_id":"1","routing":"ABC","version":"1","version_type":"external"}}
{"id": "1", "name" : "Raj", "type": "ABC"}
{"index":{"_id":"1","routing":"XYC","version":"1","version_type":"external"}}
{"id": "1", "name" : "Raj", "type": "XYC"}
{"index":{"_id":"1","routing":"PQR","version":"1","version_type":"external"}}
{"id": "1", "name" : "Raj", "type": "PQR"}
output:
{"took":9,"errors":true,"items":[{"index":{"_index":"test","_type":"_doc","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":2,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}},{"index":{"_index":"test","_type":"_doc","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":2,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}},{"index":{"_index":"test","_type":"_doc","_id":"1","status":409,"error":{"type":"version_conflict_engine_exception","reason":"[1]: version conflict, current version [1] is higher or equal to the one provided [1]","index_uuid":"VP024Sr9TRqsLBzsfEYoUA","shard":"1","index":"test"}}}]}
Not sure why i'm getting version conflict for third record alone not for the second. is their any way to keep same _id with different routing records in index ?