cURL for Windows: how can I send multiple line command in a console?

curious1 picture curious1 · Jul 3, 2014 · Viewed 11.2k times · Source

I am learning to use cURL and I need to run this in a console:

curl -XGET localhost:9200/library/book/_search?pretty=true -d {
    "query" : {
        "query_string" : { "query" : "title:crime" }
    }
}

But this is a multi-line command. How can I handle it to send a complete command?

Note that I understand I can put the content after -d in a file to run this command.

Answer

Adnan picture Adnan · Apr 28, 2015

I didn't find any way so far to send command spanning multiple using curl on windows. However, I was able to find a way to get the task done. Below is how I would rewrite the command you are trying to achieve

curl -XGET localhost:9200/library/book/_search?pretty=true -d "{ \"query\" : { \"query_string\" : { \"query\" : \"title:crime\" }  } }"

Just make sure the /library/book/ is right index name.

Hoping to hear back if you are able to make it