Search in sources :

Example 1 with RemoveAliasMapping

use of io.searchbox.indices.aliases.RemoveAliasMapping 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)

Example 2 with RemoveAliasMapping

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

the class IndicesAdapterES6 method removeAliases.

@Override
public void removeAliases(Set<String> indices, String alias) {
    final AliasMapping removeAliasMapping = new RemoveAliasMapping.Builder(ImmutableList.copyOf(indices), alias).build();
    final ModifyAliases request = new ModifyAliases.Builder(removeAliasMapping).build();
    JestUtils.execute(jestClient, request, () -> "Couldn't remove alias " + alias + " from indices " + indices);
}
Also used : AddAliasMapping(io.searchbox.indices.aliases.AddAliasMapping) RemoveAliasMapping(io.searchbox.indices.aliases.RemoveAliasMapping) AliasMapping(io.searchbox.indices.aliases.AliasMapping) ModifyAliases(io.searchbox.indices.aliases.ModifyAliases) RemoveAliasMapping(io.searchbox.indices.aliases.RemoveAliasMapping)

Example 3 with RemoveAliasMapping

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

the class ClientES6 method removeAliasMapping.

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

Aggregations

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