elasticsearch,Curl,elasticsearch" /> elasticsearch,Curl,elasticsearch" />

通过curl结果放置索引映射出错(内容类型标题修复不起作用)

通过curl结果放置索引映射出错(内容类型标题修复不起作用),curl,elasticsearch,Curl,elasticsearch,嗨 我从ES 5迁移到ES 6,并尝试像往常一样使用curl推送以下映射: "mappings" : { "mee": { "properties" : { "ind1" : { "type" : "float" }, "ind2" : { "type" : "float" }, "ind3" : { "type" : "float" }, "time" : { "type" : "date", "format" : "HH

我从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],“状态”:406}

作为一个标题是必要的(根据ES 6),我做了以下几点:

$ curl -XPUT "http://localhost:9200/mee/" -H 'Content-Type: application/json' -d @config/ESConf/ESUpdate.conf
{“错误”:{“根本原因”:[{“类型”:“非内容异常”,“原因”:“压缩器” 只能对某些xcontent字节或压缩字节调用检测 卓越的 字节“}],“类型”:“非内容异常”,“原因”:“压缩器” 只能对某些xcontent字节或压缩字节调用检测 xcontent字节“}”,状态:500}

现在我完全迷路了。。。我只是不明白这个错误。。。我做错什么了吗


谢谢大家!

映射的语法有问题。将整个映射定义括在花括号中,并确保括号配对。同时删除最后一个属性后的多余逗号。以下是正确请求正文的稍微格式化的示例:

{
  "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"
        }
      }
    }
  }
}

哎呀,只是忘了一个括号。。。但在ES 5上,当我出错时,我出现了一个json解析错误。也许这是因为现在ES 6上的标题要求。无论如何,谢谢你!