newLearner
newLearner

Reputation: 747

Elasticsearch - Point alias from OLD_INDEX to NEW_INDEX

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.

Upvotes: 0

Views: 49

Answers (1)

Gibbs
Gibbs

Reputation: 22956

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.

Upvotes: 1

Related Questions