0

I have an alias which is pointing to my OLD_INDEX. I have a requirement where I am creating a new index and after creation I need to point my alias A to the NEW_INDEX. I need to do this in Java.

I have looked almost everywhere but I cannot find any java implementation for this.

Would really appreciate some help. If possible, it would be great to have a sample code as well.

Thanks.

newLearner
  • 637
  • 1
  • 12
  • 20

1 Answers1

1

Refer

You can add7remove an alias.

To remove, POST /_aliases { "actions" : [ { "remove" : { "index" : "test1", "alias" : "alias1" } } ] }

To add an alias,

POST /_aliases { "actions" : [ { "add" : { "index" : "test1", "alias" : "alias1" } } ] }

List of supported actions

You can use java low or high level clients to do this. Refer

You have to initialize Rest client and make a call by using above Json requests and end points.

Gibbs
  • 21,904
  • 13
  • 74
  • 138