【发布时间】:2020-07-12 15:13:39
【问题描述】:
我正在尝试运行此命令
curl -XPUT -H "Content-Type: application/json" https://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
但这会导致这个错误
curl: (6) Could not resolve host: http
curl: (3) unmatched close brace/bracket in URL position 5:
null}'
我从这里得到这个命令
https://stackoverflow.com/a/50609418/3259896
我对 curl 和 elasticseach 还不是很熟悉,所以我不确定如何查明错误
如果有什么不同,我使用的是 Windows。
我也试过了
$ curl -X PUT -H "Content-Type: application/json" https://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
编辑2:
我试过了
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
但是现在出现这个错误
{"error":{"root_cause":[{"type":"json_parse_exception","reason":"Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@446f2dd5; line: 1, column: 2]"}],"type":"json_parse_exception","reason":"Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@446f2dd5; line: 1, column: 2]"},"status":400}curl: (3) unmatched close brace/bracket in URL position 5:
null}'
^
然后我尝试了
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d "{"index.blocks.read_only_allow_delete": null}"
我得到了
{"error":{"root_cause":[{"type":"json_parse_exception","reason":"Unexpected character ('i' (code 105)): was expecting double-quote to start field name\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@696b36d3; line: 1, column: 3]"}],"type":"json_parse_exception","reason":"Unexpected character ('i' (code 105)): was expecting double-quote to start field name\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@696b36d3; line: 1, column: 3]"},"status":400}
【问题讨论】:
标签: elasticsearch curl