# CURL command not working

**URL:** https://discuss.elastic.co/t/curl-command-not-working/64519
**Category:** Logstash
**Created:** [November 1, 2016, 7:18am UTC](https://discuss.elastic.co/t/curl-command-not-working/64519 "2016-11-01T07:18:04Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![VijayKarthikeyan](https://avatars.discourse-cdn.com/v4/letter/v/8491ac/32.png) [@VijayKarthikeyan](https://discuss.elastic.co/u/VijayKarthikeyan)
#### Post date: [November 1, 2016, 7:18am UTC](https://discuss.elastic.co/t/curl-command-not-working/64519/1 "2016-11-01T07:18:04Z")

</div>

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](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](http://localhost:9200/logstash-2016.10.20)'
- 

```
 ~~~~~

```

  - CategoryInfo : InvalidArgument: (🙂 [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

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [November 1, 2016, 8:23am UTC](https://discuss.elastic.co/t/curl-command-not-working/64519/2 "2016-11-01T08:23:17Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![VijayKarthikeyan](https://avatars.discourse-cdn.com/v4/letter/v/8491ac/32.png) [@VijayKarthikeyan](https://discuss.elastic.co/u/VijayKarthikeyan)
#### Post date: [November 1, 2016, 9:51am UTC](https://discuss.elastic.co/t/curl-command-not-working/64519/3 "2016-11-01T09:51:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [November 1, 2016, 10:00am UTC](https://discuss.elastic.co/t/curl-command-not-working/64519/4 "2016-11-01T10:00:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![krlplm](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@krlplm](https://discuss.elastic.co/u/krlplm)
#### Post date: [November 1, 2016, 12:31pm UTC](https://discuss.elastic.co/t/curl-command-not-working/64519/5 "2016-11-01T12:31:11Z")

</div>

Try running as below,

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

---

<div class="post-metadata">

### Author: ![VijayKarthikeyan](https://avatars.discourse-cdn.com/v4/letter/v/8491ac/32.png) [@VijayKarthikeyan](https://discuss.elastic.co/u/VijayKarthikeyan)
#### Post date: [November 1, 2016, 12:46pm UTC](https://discuss.elastic.co/t/curl-command-not-working/64519/6 "2016-11-01T12:46:12Z")

</div>

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'?

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [November 1, 2016, 12:55pm UTC](https://discuss.elastic.co/t/curl-command-not-working/64519/7 "2016-11-01T12:55:01Z")

</div>

> 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.

---

<div class="post-metadata">

### Author: ![VijayKarthikeyan](https://avatars.discourse-cdn.com/v4/letter/v/8491ac/32.png) [@VijayKarthikeyan](https://discuss.elastic.co/u/VijayKarthikeyan)
#### Post date: [November 2, 2016, 6:40am UTC](https://discuss.elastic.co/t/curl-command-not-working/64519/8 "2016-11-02T06:40:43Z")

</div>

Thank you Magnus

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 4:31am UTC](https://discuss.elastic.co/t/curl-command-not-working/64519/9 "2017-07-06T04:31:36Z")

</div>


