具有相同源和目标的 Elasticsearch 重新索引

Elasticsearch reindex with same source and destination

我更新了我的 mappings/synonyms。我想将我的数据重新索引到相同的索引。 我试过 _reindex API

POST _reindex
{
  "source": {
    "index": "test"
  },
  "dest": {
    "index": "test"
  }
}

我收到以下错误

{
  "error": {
    "root_cause": [
      {
        "type": "action_request_validation_exception",
        "reason": "Validation Failed: 1: reindex cannot write into an index its reading from [test];"
      }
    ],
    "type": "action_request_validation_exception",
    "reason": "Validation Failed: 1: reindex cannot write into an index its reading from [test];"
  },
  "status": 400
}

我做错了什么

这是 elasticsearch 中的未解决问题。 details here

您可以查看 _update_by_query API:
它更新与指定查询匹配的文档。如果未指定查询,则在不修改源的情况下对索引中的每个文档执行更新,这对于获取映射更改很有用。

POST index_name/_update_by_query?conflicts=proceed

更多信息here