我正在尝试从Windows操作系统创建一个只有一个分片的索引。我从elastic website获得了代码,我只将简单的引号改为double和3比1,我的curl看起来像这样:curl -XPUT" localhost:9200 / twitter ?漂亮的" -H" Content-Type:application / json" -d {"设置":{"索引":{" number_of_shards":1," number_of_replicas":2}}}
当我运行时,我收到以下错误:
{
"error" : {
"root_cause" : [
{
"type" : "parse_exception",
"reason" : "Failed to parse content to map"
}
],
"type" : "parse_exception",
"reason" : "Failed to parse content to map",
"caused_by" : {
"type" : "json_parse_exception",
"reason" : "Unexpected character ('s' (code 115)): was expecting double-quote to start field name\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@f220023; line: 1, column: 3]"
}
},
"status" : 400
}
我做错了什么?
答案 0 :(得分:2)
由于我熟悉postman
在这里的操作,所以:
<强>邮差强>
选择PUT方法
本地主机:9200 /微博
移至邮递员的正文部分,点击RAW
单选按钮,然后从binary
单选按钮
现在您只需要以JSON格式发送设置
{"settings":{"index":{"number_of_shards":1,"number_of_replicas":2}}}
注意:在发送JSON时不要使用引号。
答案 1 :(得分:0)
curl -XPUT "localhost:9200/twitter?pretty" \
-H "Content-Type: application/json" \
-d '{"settings":{"index":{"number_of_shards":1,"number_of_replicas":2}}}'
试试这个,你需要引用你的数据(-d)