use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest in project graylog2-server by Graylog2.
the class IndicesAdapterES7 method cycleAlias.
@Override
public void cycleAlias(String aliasName, String targetIndex, String oldIndex) {
final IndicesAliasesRequest.AliasActions addAlias = new IndicesAliasesRequest.AliasActions(IndicesAliasesRequest.AliasActions.Type.ADD).index(targetIndex).alias(aliasName);
final IndicesAliasesRequest.AliasActions removeAlias = new IndicesAliasesRequest.AliasActions(IndicesAliasesRequest.AliasActions.Type.REMOVE).index(oldIndex).alias(aliasName);
final IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest().addAliasAction(removeAlias).addAliasAction(addAlias);
client.execute((c, requestOptions) -> c.indices().updateAliases(indicesAliasesRequest, requestOptions), "Couldn't switch alias " + aliasName + " from index " + oldIndex + " to index " + targetIndex);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest in project graylog2-server by Graylog2.
the class IndicesAdapterES7 method removeAliases.
@Override
public void removeAliases(Set<String> indices, String alias) {
final IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
final IndicesAliasesRequest.AliasActions aliasAction = IndicesAliasesRequest.AliasActions.remove().alias(alias).indices(indices.toArray(new String[0]));
indicesAliasesRequest.addAliasAction(aliasAction);
client.execute((c, requestOptions) -> c.indices().updateAliases(indicesAliasesRequest, requestOptions), "Couldn't remove alias " + alias + " from indices " + indices);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest in project graylog2-server by Graylog2.
the class ClientES7 method addAliasMapping.
@Override
public void addAliasMapping(String indexName, String alias) {
final IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
final AliasActions aliasAction = new AliasActions(AliasActions.Type.ADD).index(indexName).alias(alias);
indicesAliasesRequest.addAliasAction(aliasAction);
client.execute((c, requestOptions) -> c.indices().updateAliases(indicesAliasesRequest, requestOptions), "failed to add alias " + alias + " for index " + indexName);
}
Aggregations