curl通过HTTP协议与Elasticsearch通信报错解决方案

一、请求:curl -XGET 'http://localhost:9200/_count?pretty'  -d '{ "query":{"match_all":{} } }'

返回错误信息:

{

  “error":"Content-Type header [application/x-www-form-urlencoded] is not supported",

  "status":406

}

解决方式:添加 -H "content-Type:application/json"即可处理,curl -XGET 'http://localhost:9200/_count?pretty' 

-H "content-Type:application/json" -d '{ "query":{"match_all":{} } }'

 

posted @ 2020-04-01 16:41  风雨萧萧  阅读(349)  评论(0编辑  收藏  举报