elasticsearch - 卷曲“(6)无法解析主机:http”
问题描述
我正在尝试运行此命令
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}
解决方案
首先,在另一个 SO 问题中,ES 节点是一个活动节点,因此它的 URL 包含https
.
您的本地主机几乎可以肯定不会将其https
更改为http
:
curl -XPUT -H "Content-Type: application/json" \
http://localhost:9200/_all/_settings \
-d '{"index.blocks.read_only_allow_delete": null}'
除此之外,只要你的 ES正在运行,一切看起来都很好。
成功后,您应该会收到一条简单的消息:
{"acknowledged":true}
编辑:一起去
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d "{\"index.blocks.read_only_allow_delete\": null}"
推荐阅读
- text-to-speech - 尝试获取 Microsoft Text-to-speech 上的语音列表时出现 404 错误
- ios - Swift 泛型 - 无法将值转换为类型
- reactjs - 为什么我不能使用全局空间中的 react 和 express 库(通过 npm i -g pkgName 安装)但我可以使用全局空间中的 react-scripts
- sql - postgres/Sequelize:如果属性值匹配,则编辑 jsonb 数组中的对象
- mysql - 如果没有未来记录,则选择过去的记录,否则选择第一个未来记录
- javascript - 在打字稿中输入路线(反应导航)
- javascript - 我的按钮文本总是显示在我为其设置的填充之外?
- java - Callbable 语句 JDBC 性能问题
- linux - ftp:登录到服务器,自动更改远程目录,然后带来用户输入?
- python - 得到[Errno 54]连接由python中的对等方重置