【问题标题】:Getting RoutingMissingException while migrating from ES 2.2.0 to ES 2.3.0从 ES 2.2.0 迁移到 ES 2.3.0 时出现 RoutingMissingException
【发布时间】:2016-03-30 21:43:51
【问题描述】:

我在 BulkRequest 中使用 prepareDelete 查询,其中我有一组我必须删除的 ID。

我用过:

BulkRequestBuilder bulkRequest = searchClient.prepareBulk();
for id in ids {
    bulkRequest.add(searchClient.prepareDelete("indexName", "childType", id));
}
BulkResponse bulkResponse = bulkRequest.execute().actionGet();

这种删除结构在 ES 2.2.0 中有效,但在 ES 2.3.0 中我得到RoutingMissingException

如果我打印 bilkResponse.buildFailureMessage() 并得到 ​​p>

[0]: index [indexName], type [childType], id [215f3228a3c53970883ae0d3b22dae6f], message [[indexName] RoutingMissingException[routing is required for [indexName]/[childType]/[215f3228a3c53970883ae0d3b22dae6f]]]

我什至没有更改现有索引的设置/映射。

可能是什么原因?

【问题讨论】:

    标签: java elasticsearch elasticsearch-java-api


    【解决方案1】:

    似乎是一个类似于here回答的问题

    引用完成的答案

    当你有父子关系时,你需要指定 每次尝试访问子项时,URL 中的父项,因为 路由现在取决于父级。

    在您的示例中,您想尝试一下:

    curl -XDELETE http://localhost:9200/indexName/childType/215f3228a3c53970883ae0d3b22dae6f?parent=[parent_id]

    这也可能对您有所帮助。 Delete child doc

    【讨论】:

      【解决方案2】:

      @rahulroc 是对的。我正在添加一个按时间顺序排列的对引入此功能的问题的引用列表:

      1. Don't broadcast deletes to all shards (2014)
      2. Delete api: remove broadcast delete if routing is missing when required (2015)
      3. Bulk api: fail deletes when routing is required but not specified (2016)

      也许更新 3 是导致异常出现在 es-2.3.0 中的一个。 所以你可以使用 has_child query 从子文档 id 中获取父级。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-01-04
        • 2022-11-26
        • 2017-06-05
        • 2013-10-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-10-24
        相关资源
        最近更新 更多