# How to delete only type in elasticsearch 2.4

**URL:** <https://discuss.elastic.co/t/how-to-delete-only-type-in-elasticsearch-2-4/76752>\
**Category:** Elasticsearch\
**Created:** [February 28, 2017, 9:51am UTC](https://discuss.elastic.co/t/how-to-delete-only-type-in-elasticsearch-2-4/76752 "2017-02-28T09:51:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sharon\_wsf](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@Sharon\_wsf](https://discuss.elastic.co/u/Sharon_wsf)\
**Post date:** [February 28, 2017, 9:51am UTC](https://discuss.elastic.co/t/how-to-delete-only-type-in-elasticsearch-2-4/76752/1 "2017-02-28T09:51:06Z")

</div>

Hi team,

when insert data to elasticsearch, i have  
GET /news/testing/  
GET /news/trkd/  
GET /news/nar/

the type will be different. How to delete the type i need?  
when i use DELETE news/trkd/ , the error will be show 'No handler found for uri [/news/trkd/] and method [DELETE]'.  
If i use DELETE news/ it will success, but it will delete all type i insert.  
How to delete type i need ?

Thanks and Best regards  
Sharon

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [February 28, 2017, 10:16am UTC](https://discuss.elastic.co/t/how-to-delete-only-type-in-elasticsearch-2-4/76752/2 "2017-02-28T10:16:44Z")

</div>

Hi @Sharon_wsf,

you need to install the [delete by query plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/plugins-delete-by-query.html) and then delete all documents belonging to that type with a query, e.g.:

```auto
DELETE /news/testing/_query
{
  "query": { 
      "match_all": {}
  }
}

```

A better solution is to use multiple indexes instead of multiple types. You can use aliases to assign alternative names to indices.

Daniel

---

<div class="post-metadata">

**Author:** ![Sharon\_wsf](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@Sharon\_wsf](https://discuss.elastic.co/u/Sharon_wsf)\
**Post date:** [February 28, 2017, 4:19pm UTC](https://discuss.elastic.co/t/how-to-delete-only-type-in-elasticsearch-2-4/76752/3 "2017-02-28T16:19:57Z")

</div>

Thanks for your helping..  
What is the meaning aliases to assign alternative name to indices?  
Can have example?  
Sorry, im new in elasticsearch, but the guide not very clear, so most if it i not very understand..

---

<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:** [March 28, 2017, 4:20pm UTC](https://discuss.elastic.co/t/how-to-delete-only-type-in-elasticsearch-2-4/76752/4 "2017-03-28T16:20:05Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
