【发布时间】:2018-06-15 01:51:34
【问题描述】:
我正在查看 ElasticSearch 5.6 上的单一类型索引示例,以准备删除映射类型。具体来说,我正在使用 docker.elastic.co/elasticsearch/elasticsearch:5.6.5 映像在 Docker 中本地运行的新集群上运行来自 ElasticSearch page about the removal of types 的第一个示例
从我链接到的部分运行第一个示例:
PUT localhost:9200/users
{
"settings": {
"index.mapping.single_type": true
},
"mappings": {
"_doc": {
"properties": {
"name": {
"type": "text"
},
"user_name": {
"type": "keyword"
},
"email": {
"type": "keyword"
}
}
}
}
}
我收到以下错误:
{
"error": {
"root_cause": [
{
"type": "invalid_type_name_exception",
"reason": "mapping type name [_doc] can't start with '_'"
}
],
"type": "invalid_type_name_exception",
"reason": "mapping type name [_doc] can't start with '_'"
},
"status": 400
}
我了解名称中带有前导下划线的字段通常被认为是为 ES 内部保留的;但我假设_doc 将被视为从版本5.6 开始的特殊情况,因为链接指南提到:
在 6.x 中创建的索引只允许每个索引使用单一类型。该类型可以使用任何名称,但只能有一个。首选类型名称是 _doc,以便索引 API 具有与 7.0 中相同的路径
我是否遗漏了某些内容,例如集群设置?
【问题讨论】:
标签: elasticsearch elasticsearch-5