Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curl on command prompt giving could not resolve localhost

I am trying to run some elastic commands through curl.

On command prompt, when I type:

  • curl www.google.com: it works fine
  • curl localhost:9200: elastic search hosted here, works fine

But, the command:

curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary "@accounts.json"`

Gives me error: Could not resolve host: 'localhost

Below is snapshot.error in window cmd

Can someone suggest me how to correct this? Or if somehow I can use postman or some other http client to run this command?

like image 439
Sahil Sharma Avatar asked Dec 18 '22 13:12

Sahil Sharma


1 Answers

Specify the protocol and change the quotes:

curl -XPOST "http://localhost:9200/bank/account/_bulk?pretty" --data-binary "@accounts.json"
like image 80
Henrik Avatar answered May 24 '23 10:05

Henrik