在 Java 中使用 JEST API 为索引添加别名并删除索引

Add alias to index and remove index using JEST API in Java

我正在使用 jest api 连接到弹性搜索 我想知道 Jest 中是否有一种方法可以使用现有索引名称向索引添加别名并在同一操作中删除索引。像这样,但是通过 Jest api:

POST /_aliases
{
    "actions" : [
        { "add":  { "index": "new_index", "alias": "index_1" } },
        { "remove_index": { "index": "index_1" } }  
    ]
}

它还没有在 Jest 中实现。看起来 Jest 至少可以说是“休眠”了...

您应该考虑利用 official High-Level Java REST client instead as it provides support for doing exactly what you need

JEST 中似乎没有 API 可以在同一个 API 中执行此操作,但您可以使用两个不同的 API,一个用于添加别名,另一个用于删除一个别名。

请提供alias mapping(abstract class) which is implemented by Add alias mapping and remove alias mapping类的源代码。

如@Val所述,它一直处于休眠状态()并且不支持最新版本的elasticsearch(不超过6也是生命的尽头),所以最好迁移到official Java client 如果可以的话。