1

I am trying to remove an alias mapping for an index in ES using jest.

Here is what I have tried :

// create Jest Client.

JestClient client = factory.getObject();

// create RemoveAliasMapping Object.

RemoveAliasMapping removeAliasMapping = new RemoveAliasMapping.Builder("oldIndex", "alias").build();

After creating the removeAliasMapping object, I couldn't find a way to execute it.

If I use the api : client.execute(removeAliasMapping), it says : The method execute(Action<T>) in the type JestClient is not applicable for the arguments (RemoveAliasMapping)

Also, I couldn't find any other api exposed to execute AliasMapping.

Can anyone help me out with this here? If possible, please put an example too.

Nkosi
  • 235,767
  • 35
  • 427
  • 472
Anirudh
  • 13
  • 3

1 Answers1

3

Try this:

ModifyAliases modifyAliases = new ModifyAliases.Builder(new RemoveAliasMapping.Builder("oldIndex", "alias").build()).build();
JestResult result = client.execute(modifyAliases);
Andrei Stefan
  • 51,654
  • 6
  • 98
  • 89