问题描述
curl -XPOST 'localhost:9200/books/es/1' -d '{"title":"Elasticsearch Server", "pubilished":2013}'
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
需要指定对应的header头: -H "Content-Type: application/json"
解决方法
curl -H "Content-Type: application/json" -XPOST 'localhost:9200/books/es/1' -d '{"title":"Elasticsearch Server", "publicshed":2013}'
摘自:https://blog.csdn.net/dtiove/article/details/78870607