elasticsearch CURL:不支持内容类型头[application/x-www-form-urlencoded],elasticsearch,curl,elasticsearch,Curl" /> elasticsearch CURL:不支持内容类型头[application/x-www-form-urlencoded],elasticsearch,curl,elasticsearch,Curl" />

elasticsearch CURL:不支持内容类型头[application/x-www-form-urlencoded]

elasticsearch CURL:不支持内容类型头[application/x-www-form-urlencoded],elasticsearch,curl,elasticsearch,Curl,处理ElasticSearch并尝试一些创建索引的查询,使用curl发布数据 使用GIT(Windows GIT)提供的curl 该命令用于将文档添加到名为customer的索引中 ElasticSearch站点中的curl命令复制如下: curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d' { "name": "John Doe" } ' 上面的命令对我不起作

处理ElasticSearch并尝试一些创建索引的查询,使用curl发布数据

使用GIT(Windows GIT)提供的curl

该命令用于将文档添加到名为customer的索引中

ElasticSearch站点中的curl命令复制如下:

curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
  "name": "John Doe"
}
'
上面的命令对我不起作用。我只做了一行,如下所示

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

其他命令,如创建索引,如下所示运行

curl -X PUT "localhost:9200/customer?pretty"

Response is :

{
      "acknowledged" : true,
      "shards_acknowledged" : true,
      "index" : "customer"
    }
将json作为内容的curl命令不起作用

已引用下面的链接,但无法获取
在Windows上,您需要使用双引号并转义内容中的引号:

curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H "Content-Type: application/json" -d "{\"name\": \"John Doe\"}"
或者,您可以将内容存储在名为data.json的文件中

{"name": "John Doe"}
然后像这样通过curl发送,这样就不必逃避双引号:

curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H "Content-Type: application/json" --data-binary @data.json

在Windows上,您需要使用双引号并转义内容中的双引号:

curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H "Content-Type: application/json" -d "{\"name\": \"John Doe\"}"
或者,您可以将内容存储在名为data.json的文件中

{"name": "John Doe"}
然后像这样通过curl发送,这样就不必逃避双引号:

curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H "Content-Type: application/json" --data-binary @data.json