【问题标题】:Elastic GET by ID query on rollover alias fails with ""Alias [...] has more than one indices associated with it..."对翻转别名进行 Elastic GET by ID 查询失败,并显示“别名 [...] 有多个与之关联的索引...”
【发布时间】:2020-06-26 02:55:03
【问题描述】:

我们的新展期指数刚刚展期。现在这个查询...

GET http://my.elastic/system-logs/_doc/7e8017d8-0cb8-4b9e-b021-b2a4b4ac71c7

...失败了:

"Alias [system-logs] has more than one indices associated with it [[system-logs-000002, system-logs-000001]], can't execute a single index op"

但是用_search 做同样的事情可以正常工作:

GET http://my.elastic/system-logs/_search/
{
    "query": {
        "bool": {
            "must": [{"term": {"_id": "a1906f52-3957-4f4b-9b40-531422e3a04e"}}]
            }
        }
}

异常来自this code,看起来有一个allowAliasesToMultipleIndices 设置,但我一直找不到设置它的地方。

我们使用的是 Elastic 6.8。

【问题讨论】:

    标签: elasticsearch alias rollover


    【解决方案1】:

    在第一个http request 中,您只是试图在索引上找到具有特定 id 的文档,而该索引又是多个索引的别名。

    这就是问题所在。

    原因:

    _doc 是弹性搜索中的一种映射类型。它用于隔离同一索引中的文档。所以它不能检查索引。它已被弃用。 Refer, this also

    并且您需要将GET 请求与允许的查询一起使用[如您的第二个示例] (term, terms, match, query_string, simple_query_string). Refer

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-26
      相关资源
      最近更新 更多