从 ES 2.2.0 迁移到 ES 2.3.0 时获取 RoutingMissingException
Getting RoutingMissingException while migrating from ES 2.2.0 to ES 2.3.0
我在 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()
并得到
[0]: index [indexName], type [childType], id [215f3228a3c53970883ae0d3b22dae6f], message [[indexName] RoutingMissingException[routing is required for [indexName]/[childType]/[215f3228a3c53970883ae0d3b22dae6f]]]
我什至没有更改现有索引的settings/mapping。
可能是什么原因?
似乎是一个类似于 here
回答的问题
引用答案完成
When you have a parent child relationship, you need to specify the
parent in the URL each time you try to access it a child, since
routing now depends on the parent.
In your example, you'd want to try:
curl -XDELETE http://localhost:9200/indexName/childType/215f3228a3c53970883ae0d3b22dae6f?parent=[parent_id]
这对您也有帮助。 Delete child doc
@rahulroc 是对的。我正在添加一个按时间顺序排列的引用列表,以引用引入此功能的问题:
- Don't broadcast deletes to all shards (2014)
- Delete api: remove broadcast delete if routing is missing when required (2015)
- Bulk api: fail deletes when routing is required but not specified (2016)
可能是更新 3 导致异常出现在 es-2.3.0
中。
因此,您可以只使用 has_child
query 从子文档 ID 中获取父文档。
我在 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()
并得到
[0]: index [indexName], type [childType], id [215f3228a3c53970883ae0d3b22dae6f], message [[indexName] RoutingMissingException[routing is required for [indexName]/[childType]/[215f3228a3c53970883ae0d3b22dae6f]]]
我什至没有更改现有索引的settings/mapping。
可能是什么原因?
似乎是一个类似于 here
回答的问题引用答案完成
When you have a parent child relationship, you need to specify the parent in the URL each time you try to access it a child, since routing now depends on the parent.
In your example, you'd want to try:
curl -XDELETE http://localhost:9200/indexName/childType/215f3228a3c53970883ae0d3b22dae6f?parent=[parent_id]
这对您也有帮助。 Delete child doc
@rahulroc 是对的。我正在添加一个按时间顺序排列的引用列表,以引用引入此功能的问题:
- Don't broadcast deletes to all shards (2014)
- Delete api: remove broadcast delete if routing is missing when required (2015)
- Bulk api: fail deletes when routing is required but not specified (2016)
可能是更新 3 导致异常出现在 es-2.3.0
中。
因此,您可以只使用 has_child
query 从子文档 ID 中获取父文档。