elasticsearch,curl,put,Rest,elasticsearch,Curl,Put" /> elasticsearch,curl,put,Rest,elasticsearch,Curl,Put" />

查询REST put的问题,弹性搜索

查询REST put的问题,弹性搜索,rest,elasticsearch,curl,put,Rest,elasticsearch,Curl,Put,我想通过elasticsearch发送json格式的数据,但我做不到 我使用的是elasticsearch 7.0.1版和curl 7.64版,我使用的是windows 10 curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d' { "name": "John Doe" } ' 我收到以下错误消息: { 错误:不支持内容类型标题[application/x-ww

我想通过elasticsearch发送json格式的数据,但我做不到

我使用的是elasticsearch 7.0.1版和curl 7.64版,我使用的是windows 10

curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
  "name": "John Doe"
}
'
我收到以下错误消息:

{ 错误:不支持内容类型标题[application/x-www-form-urlencoded],状态:406

}

curl:6无法解析主机:应用程序

curl:3使用错误/非法格式的URL或缺少URL


在Windows上,您需要在所有位置使用双引号,而不是单引号:

curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H "Content-Type: application/json" -d "{ \"name\": \"John Doe\" }"