Newbie. Trouble getting through the online guide

Installed v 7.0.0-alpha2 on Windows 10. Using the getting-started guide at https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-explore.html I am able to get the cluster health. I am able to list the indices. I am able to create an index. But when I try to put some data into the index (using the COPY AS CURL link to copy the curl command to the clipboard and then paste into my cmd shell), I get the following:

C:\Users\bmclaugh>curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
  "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
  "status" : 406
}
curl: (6) Could not resolve host: application

C:\Users\bmclaugh>{
'{' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\bmclaugh>  "name": "John Doe"
'"name":' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\bmclaugh>}
'}' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\bmclaugh>'
''' is not recognized as an internal or external command,
operable program or batch file.

That looked like a cr/lf issue, so I reformatted the curl command to reside on a single line. I get the following:

C:\Users\bmclaugh>curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d '{"name": "John Doe"}'
{
  "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
  "status" : 406
}
curl: (6) Could not resolve host: application
curl: (3) [globbing] unmatched close brace/bracket in column 9

What am I doing wrong here? Again, the first attempt above is a copy/paste from the getting-started-query-document.html online.

Thanks,

Brian

Curl on windows is challenging.
I'd recommend starting Kibana and running examples from the Kibana dev console instead.

You may want to use Windows Subsystem for Linux (WSL) on Windows, to have a Linux Bash shell experience on Windows. With WSL, the curl commands should work exactly as in the docs.

As an alternative, if you would prefer to use PowerShell, I put together a small PowerShell Script module that you may want to check out for issuing curl-like requests to Elasticsearch.

You can install into a PowerShell session (may need to change your Execution Policy to do this), then can run the commands

For example, the first command in your question

es "http://localhost:9200/customer/_doc/1?pretty" -X PUT -d @'
{
  "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
  "status" : 406
}
'@

Thank you guys. I quit trying to use it from the windows command prompt. I installed it on Linux, and using curl from the bash shell worked just fine.

Thanks,

Brian

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.