ElasticSearch创建索引报错

当执行

curl -X PUT '9.112.4.34:9200/accounts/person/1' -d '
{
  "user": "张三",
  "title": "工程师",
  "desc": "数据库管理"
}'

报错:{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406} 

curl -H 'Content-Type:application/json' -X PUT '9.112.4.34:9200/accounts/person/1' -d '
{
  "user": "张三",
  "title": "工程师",
  "desc": "数据库管理"
}'

是由于ES在6.x后做了调整,具体信息查看官网:https://www.elastic.co/blog/strict-content-type-checking-for-elasticsearch-rest-requests

你可能感兴趣的:(ElasticSearch)