Elasticsearch reindex将旧数据保留在目标中

问题描述 投票:0回答:1

我对Elasticsearch reindex API有疑问。在我启动reindex之后,目标索引中的现有文档是否会被删除,或者它们是否保留,只添加新文档?

elasticsearch
1个回答
2
投票

默认情况下,reindex操作将覆盖已存在且具有相同ID的目标索引中的所有文档。

如果要阻止您可以使用op_type: create设置,以便仅在目标索引中添加缺少的文档。

{
  "conflicts": "proceed",
  "source": {
    "index": "my_old_index"
  },
  "dest": {
    "index": "my_new_index",
    "op_type": "create"            <--- add this
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.