Search in sources :

Example 1 with AddAliasMapping

use of io.searchbox.indices.aliases.AddAliasMapping in project graylog2-server by Graylog2.

the class ClientES6 method addAliasMapping.

@Override
public void addAliasMapping(String indexName, String alias) {
    final AddAliasMapping addAliasMapping = new AddAliasMapping.Builder(indexName, alias).build();
    final ModifyAliases addAliasRequest = new ModifyAliases.Builder(addAliasMapping).build();
    executeWithExpectedSuccess(addAliasRequest, "failed to add alias " + alias + " for index " + indexName);
}
Also used : AddAliasMapping(io.searchbox.indices.aliases.AddAliasMapping) ModifyAliases(io.searchbox.indices.aliases.ModifyAliases)

Example 2 with AddAliasMapping

use of io.searchbox.indices.aliases.AddAliasMapping in project graylog2-server by Graylog2.

the class IndicesAdapterES6 method cycleAlias.

@Override
public void cycleAlias(String aliasName, String targetIndex, String oldIndex) {
    final AliasMapping addAliasMapping = new AddAliasMapping.Builder(targetIndex, aliasName).build();
    final AliasMapping removeAliasMapping = new RemoveAliasMapping.Builder(oldIndex, aliasName).build();
    final ModifyAliases request = new ModifyAliases.Builder(Arrays.asList(removeAliasMapping, addAliasMapping)).build();
    JestUtils.execute(jestClient, request, () -> "Couldn't switch alias " + aliasName + " from index " + oldIndex + " to index " + targetIndex);
}
Also used : AddAliasMapping(io.searchbox.indices.aliases.AddAliasMapping) RemoveAliasMapping(io.searchbox.indices.aliases.RemoveAliasMapping) AliasMapping(io.searchbox.indices.aliases.AliasMapping) AddAliasMapping(io.searchbox.indices.aliases.AddAliasMapping) ModifyAliases(io.searchbox.indices.aliases.ModifyAliases) RemoveAliasMapping(io.searchbox.indices.aliases.RemoveAliasMapping)

Aggregations

AddAliasMapping (io.searchbox.indices.aliases.AddAliasMapping)2 ModifyAliases (io.searchbox.indices.aliases.ModifyAliases)2 AliasMapping (io.searchbox.indices.aliases.AliasMapping)1 RemoveAliasMapping (io.searchbox.indices.aliases.RemoveAliasMapping)1