Let's say I got the alias car-alias
pointing to car-index-1
. I now want car-alias
to point to car-index-2
.
I therefore perform the following POST
request to the Aliases API:
{
"actions": [
{
"remove": {
"index": "car-index-1",
"alias": "car-alias"
}
},
{
"add": {
"index": "car-index-2",
"alias": "car-alias"
}
}
]
}
I receive the following response:
{
"acknowledged": true
}
Can I now immediately index data into the car-alias
and it ends up in the car-index-2
?
Or does the "acknowledged": true
response not guarantee that write operations point to the right index immediately?
Yes, the alias is changed atomically and will point to car-index-2
immediately when the call returns.
As stated in the documentation "...during the swap, the alias has no downtime and never points to both streams at the same time."