【问题标题】:node-elastic full document update节点弹性完整文档更新
【发布时间】:2016-12-01 08:10:14
【问题描述】:

在我的 nodejs 弹性编写器中,我想用另一个文档替换一个文档。 目前,我运行-

            var data = { doc: doc, "doc_as_upsert": true };            
            var metadata = 
            { update: { _id: idToUpdate, _index:indexName,_type: INDEX_TYPE_PREFIX } };
            body.push(metadata);
            body.push(payment);    
        } 
        elasticsearchClient.bulk({
            body: body,
        }, function (err, resp) {

但是,如果弹性文件中包含字段 X 而更新后的文档没有,则字段 X 将保留在弹性文件中 - 我希望将其删除。 根据 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html 使用 "doc:" 用于部分更新,那么完整更新的替代方案是什么?

【问题讨论】:

  • 只是删除并重新索引?

标签: node.js elasticsearch


【解决方案1】:

不要使用更新api,而是使用索引api。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-09
    • 1970-01-01
    相关资源
    最近更新 更多