I am using version 4.2.2 of spring-data-elasticsearch in my project. We need to reindex some data every day, so we are using aliases. I have seen that there is a way to atomically remove an index from an alias and to include a new one. Link: https://www.elastic.co/guide/en/elasticsearch/guide/current/index-aliases.html
My question is if that feature is supported and included as part of version 4.2.2 of spring-data-elasticsearch, at IndexOperations class level.
EDIT
Using AliasActions to remove an existing index (the old one) and to add an alias to the new index I am getting this exception:
java.lang.NoSuchMethodError: 'org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest$AliasActions org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest$AliasActions.isHidden(java.lang.Boolean)'
var aliasActions = new AliasActions()
.add(new AliasAction.RemoveIndex(AliasActionParameters.builder()
.withIndices(oldIndexName).build()))
.add(new AliasAction.Add(
AliasActionParameters.builder().withIndices(newIndexName)
.withAliases(indexOps.getIndexCoordinates().getIndexNames()).build()));
You use the IndexOperations.alias(AliasActions aliasActions)
method for that (https://docs.spring.io/spring-data/elasticsearch/docs/4.2.2/api/org/springframework/data/elasticsearch/core/IndexOperations.html#alias-org.springframework.data.elasticsearch.core.index.AliasActions-).
An AliasAction
can be a add, remove or removeindex, and these AliasActions are sent to ES in one operation and executed there atomically.