嗨!
我从ES 5迁移到ES 6,并且我试图像往常一样用curl推送以下映射:
"mappings" : {
"mee": {
"properties" : {
"ind1" : { "type" : "float" },
"ind2" : { "type" : "float" },
"ind3" : { "type" : "float" },
"time" : { "type" : "date", "format" : "HH:mm:ss" },
"name" : { "type" : "string" },
"timestamp" : { "type" : "date", "format" : "yyyy-MM-dd HH:mm:ss" },
}
}
使用以下命令:
$ curl -XPUT "http://localhost:9200/mee/" -d @config/ESConf/ESUpdate.conf
{"错误":"内容类型标题[application / x-www-form-urlencoded]不受支持"," status":406}
由于标题是必要的(按照ES {6 required),我做了以下内容:
$ curl -XPUT "http://localhost:9200/mee/" -H 'Content-Type: application/json' -d @config/ESConf/ESUpdate.conf
{"错误" {" ROOT_CAUSE":[{"类型":" not_x_content_exception""理由&#34 ;:"压缩机 检测只能在某些xcontent字节上调用或压缩 xcontent 字节"}],"类型":" not_x_content_exception""理由":"压缩机 检测只能在某些xcontent字节上调用或压缩 xcontent bytes"}," status":500}
现在我完全迷失了......我只是不明白这个错误......我做错了什么?
谢谢!
答案 0 :(得分:1)
映射的语法有问题。将整个映射定义括在大括号中并确保括号配对。同时删除最后一个属性后的冗余逗号。以下是正确请求正文的略微格式化示例:
{
"mappings": {
"mee": {
"properties": {
"ind1": {
"type": "float"
},
"ind2": {
"type": "float"
},
"ind3": {
"type": "float"
},
"time": {
"type": "date",
"format": "HH:mm:ss"
},
"name": {
"type": "string"
},
"timestamp": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
}
}