Elasticsearch 6 甚至在简单文档上拒绝映射更新

Elasticsearch 6 rejecting mapping update to even on simple document

从 ES 5 升级到 ES 6 后,每次我想在新索引中存储内容时都会收到错误消息。但是所有旧索引都工作正常。

错误信息是:

Rejecting mapping update to [test] as the final mapping would have more than 1 type: [user, group]

我正在使用 elasticsearch 6.3。它在以前创建的索引上的生产服务器上正常工作。我试过删除索引无济于事。

我的测试文档是:

PUT test/group/1
{
    "id": "5b29fb9aa3d24b5a2b6b8fcb",
    "_mongo_id_": "5b29fb9aa3d24b5a2b6b8fcb"
}

PUT test/user/1
{
  "id": "5ad4800ca3d24be81d7a6806",
  "_mongo_id_": "5ad4800ca3d24be81d7a6806"
}

索引映射似乎没问题:

{
  "mapping": {
    "group": {
      "properties": {
        "_mongo_id_": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    }
  }
}

您正在尝试为每个 index

添加多个 type

PUT 测试/group/1

PUT 测试/user/1

ES 6 不允许这种行为。

来自breaking changes

The ability to have multiple mapping types per index has been removed in 6.0. New indices will be restricted to a single type. This is the first step in the plan to remove mapping types altogether. Indices created in 5.x will continue to support multiple mapping types.