# Deleting all documents in an index

**URL:** <https://discuss.elastic.co/t/deleting-all-documents-in-an-index/37442>\
**Category:** Elasticsearch\
**Created:** [December 17, 2015, 8:08am UTC](https://discuss.elastic.co/t/deleting-all-documents-in-an-index/37442 "2015-12-17T08:08:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AOzoukou](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@AOzoukou](https://discuss.elastic.co/u/AOzoukou)\
**Post date:** [December 17, 2015, 8:08am UTC](https://discuss.elastic.co/t/deleting-all-documents-in-an-index/37442/1 "2015-12-17T08:08:57Z")

</div>

Hello,  
I have installed latest version (2.1.0) of ElasticSearch. It works very well, you have done a very good job 🙂 . I would want to know how to clear all the documents in an index (of a specific type) without deleting the index itself (or if possible the type itself). In previous versions i was able to do that with curl -XDELETE host/index/type/ or by using "Delete by Query" .. but those are not working anymore.  
Thank you very much

---

<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:** [December 17, 2015, 8:25am UTC](https://discuss.elastic.co/t/deleting-all-documents-in-an-index/37442/2 "2015-12-17T08:25:38Z")

</div>

You need to install the delete by query plugin now.

Note that it's really a bad idea to delete by a query a full index.  
You should really remove the index instead.

---

<div class="post-metadata">

**Author:** ![Norberto\_Meijome](https://avatars.discourse-cdn.com/v4/letter/n/ed655f/32.png) [@Norberto\_Meijome](https://discuss.elastic.co/u/Norberto_Meijome)\
**Post date:** [December 17, 2015, 8:47am UTC](https://discuss.elastic.co/t/deleting-all-documents-in-an-index/37442/3 "2015-12-17T08:47:20Z")

</div>

Probably best if you used an alias , create an empty index and swap the  
index behind the alias (an atomic operation) - if that is a concern for you  
of course.

---

<div class="post-metadata">

**Author:** ![AOzoukou](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@AOzoukou](https://discuss.elastic.co/u/AOzoukou)\
**Post date:** [December 17, 2015, 9:07am UTC](https://discuss.elastic.co/t/deleting-all-documents-in-an-index/37442/4 "2015-12-17T09:07:04Z")

</div>

Thank you very much, i wil investigate the Alias solution...

---

<div class="post-metadata">

**Author:** ![AOzoukou](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@AOzoukou](https://discuss.elastic.co/u/AOzoukou)\
**Post date:** [December 17, 2015, 9:10am UTC](https://discuss.elastic.co/t/deleting-all-documents-in-an-index/37442/5 "2015-12-17T09:10:16Z")

</div>

thank you very much , i will try that direction

---

<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:30pm UTC](https://discuss.elastic.co/t/deleting-all-documents-in-an-index/37442/6 "2017-07-05T23:30:17Z")

</div>


