问题:

终端操作e s的时候出现这个问题

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

}

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

改:

curl -XGET 'localhost:9200/_count?pretty' -H 'content-Type:application/json' -d '

{

"query":{

"match_all":{}

}

返回成功:

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

 reason:

这个问题,是在报文Content-type的参数:application/x-www-form-urlencoded不支持Json发送。需要改成application/Json
所以需要添加参数 ; -H ‘Content-Type: application/json’

相关文章:

  • 2022-12-23
  • 2021-04-16
  • 2022-01-29
  • 2021-09-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-08
  • 2021-09-10
  • 2022-12-23
  • 2021-08-30
相关资源
相似解决方案