代码:
{
"setting":{
"number_of_shards":3,
"number_of_replicas":1
},
"mapping":{
"man":{
"properties":{
"name":{
"type":"text"
},
"country":{
"type":"keyword"
},
"age":{
"type":"integer"
},
"data":{
"type":"data",
"format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
},
"woman":{
}
}
}
报错信息如下:
{
"error": {
"root_cause": [
{
"type": "parse_exception",
"reason": "unknown key [mapping] for create index"
}
],
"type": "parse_exception",
"reason": "unknown key [mapping] for create index"
},
"status": 400
}
大神们如何解决?
Incorrect HTTP method for uri [/_mapping?pretty] and method [DELETE], allowed: [GET]
错误的http请求方法 通过uri的delete方法,允许get
7.1不支持其他方法请求,http只能用get方法,可以通过kibana进行其他的操作
7.x 写法
es7.x已经没有类型选择,统一为_doc,所以要把man,woman删除,直接设置属性参数即可
{
"settings":{
"number_of_shards":3,
"number_of_replicas":1
},
"mappings":{
"properties":{
"name":{
"type":"text"
},
"age":{
"type":"integer"
},
"country":{
"type":"keyword"
},
"birthday":{
"type":"date",
"format":"yyyy-MM-dd HHmmss||yyyyMMdd||epoch_millis"
}
}
}
}
PUT http://bigdata111:9200/store1
{
"mappings": {
"properties": {
"name": {
"type": "text"
},
"age": {
"type": "long"
},
"birthday": {
"type": "date"
}
}
}
}
在 PUT请求中的链接中添加?include_type_name=true即可,如:
http://localhost:9200/people?include_type_name=true
put提交指定id了吗?
你的这个问题解决了吗?急!!!
es 7+版本 取消了type 所以图上的“man” type要删除
mapping 写错了 ! 是 mappings