2

I'm trying to get this tutorial to work in CMD and Windows Powershell (Windows 7 64): http://www.elasticsearchtutorial.com/elasticsearch-in-5-minutes.html

The first command already doesn't work in CMD:

curl -XPUT 'http://localhost:9200/blog/user/dilbert' -d '{ "name" : "Dilbert Brown" }'

I get the following error message:

curl: (1) Protocol 'http not supported or disabled in libcurl
curl: (6) Could not resolve host: name
curl: (7) Failed to connect to  port 80: Connection refused
curl: (6) Could not resolve host: Dilbert Brown
curl: (3) [globbing] unmatched close brace/bracket in column 1

In Windows Powershell I get:

{"error":"MapperParsingException[failed to parse]; nested: JsonParseException[Unrecognized token 'Dilbert': was expecting ('true', 'false' or 'null')\n at [Source: [B@132b73b; line: 1, column: 33]]; ","status":400}curl: (3) [globbing] unmatched close brace/bracket in column 7

The same command works without any problems in Cygwin. How would I have to write the command to make it work in CMD and Windows Powershell?

1 Answer 1

2

In PowerShell, the command is being called correctly, from a parsing perspective.

In cmd.exe, the single quotes are not valid. You will need to use double quotes to surround values.

curl -XPUT "http://localhost:9200/blog/user/dilbert" -d "{ \"name\" : \"Dilbert Brown\" }"
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I'm using the Chrome addon "Sense" now. It makes working with ElasticSearch a lot easier than using cURL in a command line.

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.