Reputation: 2176
Context:
Question:
Is there any way to update the routingId of existing docs in ES ?
I do understand that we can persist old routingId to get the data. But is there any other way ?
Upvotes: 1
Views: 520
Reputation: 217574
If you try to modify the _routing
value during an update by query you're going to get the following error:
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "Modifying [_routing] not allowed"
}
],
"type" : "illegal_argument_exception",
"reason" : "Modifying [_routing] not allowed"
},
"status" : 400
}
Modifying the routing of a given document has the effect of potentially moving that document to a new shard and this is not allowed. Also you'd end up with two documents having the same ID in the same index, just located on two different shards.
The only way you can achieve what you need, while keeping a consistent index, is to
Upvotes: 1