CURL command not working

While doing some handson with ELK, I happen to delete an Index from ELK. I used the below command

curl -XDELETE 'http://localhost:9200/logstash-2016.10.20'

but this throws the below error

Invoke-WebRequest : A parameter cannot be found that matches parameter name 'XDELETE '.
At line:1 char:6

  • curl -XDELETE 'http://localhost:9200/logstash-2016.10.20'
  •  ~~~~~
    
    • CategoryInfo : InvalidArgument: (:slight_smile: [Invoke-WebRequest], ParameterBindingException
    • FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

So i checked whether the curl itself is working or not and found it to be working perfectly.
Please help me solve this issue

You're using some kind of PowerShell script that tries to emulate curl but doesn't support all options. This question has come up before and I believe there was a way to get PowerShell to send a DELETE request instead.

Yes am using the Windows PowerShell for server20102.

Can you please provide that instruction on how I can process that query of CURL with DELETE request? I could not find the proper solution for that

I don't know anything about PowerShell but I can't imagine it's difficult to find out how to make DELETE requests with Invoke-WebRequest. Over and out.

Try running as below,

Invoke-WebRequest -Uri http://localhost:9200/logstash-2016.10.20 -Method Delete

This seems to work perfectly. Thank you very much.

But is the Invoke-WebRequest is alternative for "curl"?
Sorry if this is a stupid question.

Also I need to know, whether the deleted index be removed from all the nodes for a request if it is stashed in multiple nodes. Are all the shards be removed for a 'delete'?

But is the Invoke-WebRequest is alternative for "curl"?

curl is just an HTTP client. Invoke-WebRequest might not be capable of everything curl can do (and vice versa) but their feature sets should be similar.

Also I need to know, whether the deleted index be removed from all the nodes for a request if it is stashed in multiple nodes.

Yes.

Are all the shards be removed for a 'delete'?

Yes. There's no point in keeping a subset of the shards.

Thank you Magnus