小编典典

Elasticsearch不支持Content-Type标头[application / x-www-form-urlencoded]

elasticsearch

我曾经有ElasticSearch 5.2,并且刚升级到6.0。

我正在尝试按照此处的指南创建索引模板,但出现错误

Content-Type header [application/x-www-form-urlencoded] is not supported

我的查询是

curl -X PUT localhost:9200/_template/template_1 -d '
{
  "index_patterns": ["te*", "bar*"],
  "mappings": {
    "type1": {
      "properties": {
        "host_name": {
          "type": "keyword"
        }
      }
    }
  }
}'

阅读 707

收藏
2020-06-22

共1个答案

小编典典

要解决此问题,请添加curl选项 -H 'Content-Type: application/json'


这个错误是由于 严格的内容类型检查 在ElasticSearch
6.0中引入,在解释这个岗位

从Elasticsearch 6.0开始,所有包含主体的REST请求也必须提供该主体的正确内容类型。

2020-06-22