ES6.2.4新建索引时报错:"mapping type name [_doc] can't start with '_'"
Elasticsearch | 作者 lhhk | 发布于2019年09月19日 | 阅读数:14936
{
"settings": {
"number_of_shards": 4,
"number_of_replicas": 1
},
"mappings": {
"_doc": {
"properties": {
"id": {
"type": "long"
}
}
}
}
}
报错信息如下:
{"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}
请问怎么解决??
"settings": {
"number_of_shards": 4,
"number_of_replicas": 1
},
"mappings": {
"_doc": {
"properties": {
"id": {
"type": "long"
}
}
}
}
}
报错信息如下:
{"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}
请问怎么解决??
1 个回复
liuxg - Elastic
赞同来自:
PUT doc1/_doc/1
{
"name": "liuxg"
}
让后,执行:
GET doc1
比较一下返回的结果,和你的配置格式。
我的twitter在在7.3上的配置是这样的。感觉你的格式不对。你不需要用"_doc"
{
"twitter" : {
"aliases" : { },
"mappings" : {
"properties" : {
"address" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"age" : {
"type" : "long"
},
"city" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"country" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"location" : {
"properties" : {
"lat" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"lon" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
},
"message" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"province" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"uid" : {
"type" : "long"
},
"user" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
},
"settings" : {
"index" : {
"creation_date" : "1568880300251",
"number_of_shards" : "1",
"number_of_replicas" : "1",
"uuid" : "WOKdxEoNQeydDvqQcpN-Ug",
"version" : {
"created" : "7030299"
},
"provided_name" : "twitter"
}
}
}
}