在不丢失数据的情况下更新索引elasticsearch

时间:2021-06-23 15:03:30

标签: node.js elasticsearch

我尝试根据需要创建新索引,根据旧索引重新索引,但没有按预期工作,数据没有一起复制

低于旧索引:

mappings: { 
  properties: {
    donor: {
      type: "nested",
      properties: {
        id: { type: "integer" },
        dateOfBirth: { type: "date" },
        profile: {
          type: "nested",
          properties: { 
            ...
          },
        },
      },
    }, 
  }
}

低于所需索引:

mappings: { 
  properties: {
    id: { type: "integer" },
    dateOfBirth: { type: "date" },
    profile: {
      type: "nested",
      properties: { 
        ...
      },
    },
  }, 
}

1 个答案:

答案 0 :(得分:0)

当您更改对象结构时,您需要创建一个迁移程序来检索旧“文档结构”/对象中的所有文档,更改“文档结构”/对象并将它们插入新索引中。< /p>