[英]Elasticsearch - Point alias from OLD_INDEX to NEW_INDEX
I have an alias which is pointing to my OLD_INDEX.我有一个指向我的 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.我有一个创建新索引的要求,创建后我需要将别名 A 指向 NEW_INDEX。 I need to do this in Java.
我需要在Java.
I have looked almost everywhere but I cannot find any java implementation for this.我几乎到处都看过,但我找不到任何 java 实现。
Would really appreciate some help.非常感谢一些帮助。 If possible, it would be great to have a sample code as well.如果可能的话,最好有一个示例代码。
Thanks.谢谢。
You can add7remove an alias.您可以添加7删除别名。
To remove, POST /_aliases { "actions": [ { "remove": { "index": "test1", "alias": "alias1" } } ] }
要删除, 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.您可以使用 java 低级或高级客户端来执行此操作。 Refer 参考
You have to initialize Rest client and make a call by using above Json requests and end points.您必须初始化 Rest 客户端并使用上述 Json 请求和端点进行调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.