Elasticsearch:一个索引只能包含一个映射类型

如果添加第二个type,会报错:

Rejecting mapping update to [mtest]

as the final mapping would have more than 1 type: [one, two]。

查询到官网的说明:

Indices created in Elasticsearch 6.0.0 or later may only contain a single mapping type. Indices created in 5.x with multiple mapping types will continue to function as before in Elasticsearch 6.x. Types will be deprecated in APIs in Elasticsearch 7.0.0, and completely removed in 8.0.0.

在6.0.0或者更高版本中仅支持单mapping type。对于5.X版本中多个mapping type依旧可以使用。计划在7.0.0中完全移除type,并在8.0.0中完全删除。

相关链接:https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html