elasticsearch,bulk,Routing,elasticsearch,Bulk" /> elasticsearch,bulk,Routing,elasticsearch,Bulk" />

Routing ElasticSearch中的DocumentMissingException通过ID进行批量更新,但通过字段进行路由

Routing ElasticSearch中的DocumentMissingException通过ID进行批量更新,但通过字段进行路由,routing,elasticsearch,bulk,Routing,elasticsearch,Bulk,运行ES 1.3.4: 路由默认为按文档索引-索引、搜索和批量更新工作! 在我的索引映射中通过文档字段定义了路由,即带有 path=文档字段名-然后路由正在使用索引、搜索和更新,其中我有要设置路由的整个文档,但按Id的批量脚本更新失败。 代码是: updateBulkDocumentsWithScript(List<String> ids, String updateScript) { final BulkRequestBuilder bulkRequestBuilder

运行ES 1.3.4:

路由默认为按文档索引-索引、搜索和批量更新工作! 在我的索引映射中通过文档字段定义了路由,即带有 path=文档字段名-然后路由正在使用索引、搜索和更新,其中我有要设置路由的整个文档,但按Id的批量脚本更新失败。 代码是:

updateBulkDocumentsWithScript(List<String> ids, String updateScript) {

    final BulkRequestBuilder bulkRequestBuilder = esClient.prepareBulk();
    for (String id : ids) {
        UpdateRequestBuilder updateRequestBuilder = esClient.prepareUpdate()
                .setIndex(index)
                .setType(type)
                .setId(id)
                // We are routing by a field but just have the Id!
                    // .setRouting(routing)
                .setScript(updateScript, ScriptType.INLINE);

        bulkRequestBuilder.add(updateRequestBuilder);
    }

    final BulkResponse bulkResponse = bulkRequestBuilder.execute().actionGet();
}
看起来所有的批量请求响应都是空的——可能是因为需要路由

如果定义了映射路由,则需要:false-我在bulkResponse.buildFailureMessage中得到一堆DocumentMissingException:

DocumentMissingException[[index][-1] [type][h4s_jzsKQDaAqcascSEOyg]: document missing]
我试图做的是不可能的吗?当我有Id时按Id更新,但当路由不是按Id时?或者这是一个ES错误。我认为给定一个Id,即使设置了不同的路由,ES也能够找到文档

DocumentMissingException[[index][-1] [type][h4s_jzsKQDaAqcascSEOyg]: document missing]