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

猜你喜欢

转载自www.cnblogs.com/paopaorun/p/12613613.html