1

I am trying to run this command

curl -XPUT -H "Content-Type: application/json" https://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

But this results in this error

curl: (6) Could not resolve host: http
curl: (3) unmatched close brace/bracket in URL position 5:
null}'

I got this command from here

https://stackoverflow.com/a/50609418/3259896

I'm am not yet very familiar with curl nor elasticseach, so I'm not sure how to pinpoint the error

If it makes a difference, I am using Windows.

I also tried

$ curl -X PUT -H "Content-Type: application/json" https://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

Edit2:

I tried

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

But now get this error

{"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}' ^

I then tried

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d "{"index.blocks.read_only_allow_delete": null}"

And I got

{"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}

1 Answer 1

2

First off, in that other SO question, the ES node was a live one so its URL included https.

Your localhost ist almost certainly not going to have https so change it to http:

curl -XPUT -H "Content-Type: application/json" \
     http://localhost:9200/_all/_settings \
     -d '{"index.blocks.read_only_allow_delete": null}'

Other than that, everything looks okay, provided that your ES is running.

When successful, you should receive a simple message:

{"acknowledged":true}

Edit: go with

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d "{\"index.blocks.read_only_allow_delete\": null}"
Sign up to request clarification or add additional context in comments.

1 Comment

I tried this but now getting a different error, original question updated with new error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.