# Can't delete index for elasticsearch

**URL:** <https://discuss.elastic.co/t/cant-delete-index-for-elasticsearch/31900>\
**Category:** Elasticsearch\
**Created:** [October 9, 2015, 8:45am UTC](https://discuss.elastic.co/t/cant-delete-index-for-elasticsearch/31900 "2015-10-09T08:45:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![supermario](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@supermario](https://discuss.elastic.co/u/supermario)\
**Post date:** [October 9, 2015, 8:45am UTC](https://discuss.elastic.co/t/cant-delete-index-for-elasticsearch/31900/1 "2015-10-09T08:45:05Z")

</div>

i have a wrong index that named 'logstash-%{type}-%{item}-2015.09.30'. i want to delete it. when i delete it by curl -XDELETE(curl -XDELETE [http://192.168.3.15:9200/logstash-%{type}-%{item}-2015.09.30](http://192.168.3.15:9200/logstash-%25%7Btype%7D-%25%7Bitem%7D-2015.09.30)) return 'curl: (52) Empty reply from server'.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 9, 2015, 8:57am UTC](https://discuss.elastic.co/t/cant-delete-index-for-elasticsearch/31900/2 "2015-10-09T08:57:49Z")

</div>

You have to escape/encode special characters like `%`, `{`...

---

<div class="post-metadata">

**Author:** ![supermario](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@supermario](https://discuss.elastic.co/u/supermario)\
**Post date:** [October 9, 2015, 9:14am UTC](https://discuss.elastic.co/t/cant-delete-index-for-elasticsearch/31900/3 "2015-10-09T09:14:28Z")

</div>

thank you , dadoonet. it's work good.

---

<div class="post-metadata">

**Author:** ![vaniaravinda](https://avatars.discourse-cdn.com/v4/letter/v/7993a0/32.png) [@vaniaravinda](https://discuss.elastic.co/u/vaniaravinda)\
**Post date:** [October 13, 2015, 6:44am UTC](https://discuss.elastic.co/t/cant-delete-index-for-elasticsearch/31900/4 "2015-10-13T06:44:27Z")

</div>

Hi @dadoonet,

I'm trying to Delete the Index through Shell script. Please find below for the code. But I'm getting the error as "curl: (52) Empty reply from server". Please let me know if there is anything I'm doing wrong.

current=$(date +"%Y-%m-%d");  
daybeforeyesterday=$( date -d "${current} -2 days" +'%Y.%m.%d' );  
oldindex=ntest-$daybeforeyesterday;  
echo $oldindex;  
curl -XDELETE '[http://localhost:9200/'"$oldindex"'](http://localhost:9200/'%22%24oldindex%22')'  
echo

Thanks,  
Vani Aravinda

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 13, 2015, 7:10am UTC](https://discuss.elastic.co/t/cant-delete-index-for-elasticsearch/31900/5 "2015-10-13T07:10:48Z")

</div>

It sounds like your server is not running or on another port or hostname?

---

<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 5, 2017, 11:45pm UTC](https://discuss.elastic.co/t/cant-delete-index-for-elasticsearch/31900/6 "2017-07-05T23:45:10Z")

</div>


