【发布时间】:2019-05-24 11:56:38
【问题描述】:
使用 ElasticSearch 并尝试一些查询以创建索引,使用 curl 发布数据。
使用 GIT 提供的 curl(Windows GIT)
该命令用于将文档添加到名为 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 命令不起作用。
已经参考了以下链接,但无法获取 Content Type Issue
【问题讨论】:
标签: elasticsearch curl