Hi folks,
my question is about reassigning an alias to the newly created index in one step.
It means, i don't want to first remove alias and add a new one, since it is not possible to send the request encapsulated in one request. IndicesAliasesRequest doesn't offer any method like reassign() or removeAndAddAlias(). The delay between remove and add requests can cause service interruptions.
Is there any workaround to solve this ?
The alias API accept a list of add/remove actions which are executed atomically in one call. Java-wise you can do the following:
client.admin().indices().prepareAliases()
.removeAlias("old_index", "my_alias")
.addAlias("new_index", "my_alias")
.execute().actionGet();
oh thanks your reply. the issue can be closed.
Most helpful comment
The alias API accept a list of add/remove actions which are executed atomically in one call. Java-wise you can do the following: