我正在尝试使用 多索引 方法,使用 elasticsearch-dsl 实现。基本上有两个步骤:
1. 创建别名:
PUT /tweets_1/_alias/tweets_search
PUT /tweets_1/_alias/tweets_index
2. 必要时更改别名:
POST /_aliases
{
"actions": [
{ "add": { "index": "tweets_2", "alias": "tweets_search" }},
{ "remove": { "index": "tweets_1", "alias": "tweets_index" }},
{ "add": { "index": "tweets_2", "alias": "tweets_index" }}
]
}
我只能使用elasticsearch-py(而不是dsl)来实现步骤1:
from elasticsearch.client import IndicesClient
IndicesClient(client).("tweets_1", "tweets_search")
IndicesClient(client).("tweets_1", "tweets_index")
我不知道如何完成第二步,那么在elasticsearch-dsl中(或至少在elasticsearch-py中)相当于什么呢?