# Delete a specific type from an index

**URL:** <https://discuss.elastic.co/t/delete-a-specific-type-from-an-index/114499>\
**Category:** Elasticsearch\
**Created:** [January 8, 2018, 10:50am UTC](https://discuss.elastic.co/t/delete-a-specific-type-from-an-index/114499 "2018-01-08T10:50:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cilzzz](https://avatars.discourse-cdn.com/v4/letter/c/c67d28/32.png) [@cilzzz](https://discuss.elastic.co/u/cilzzz)\
**Post date:** [January 8, 2018, 10:50am UTC](https://discuss.elastic.co/t/delete-a-specific-type-from-an-index/114499/1 "2018-01-08T10:50:52Z")

</div>

Hey,

I have one index named logstash\_ecps-rct\* and i have many types in it.  
i want to delete the type: mssql from it so i tried devtools:  
`DELETE logstash-ecps_rct*/mssql` and i got this error  
`No handler found for uri [/logstash-ecps_rct*/mssql] and method [DELETE]`  
can anyone tell me how to delete a specific type from an index

Thanks!

---

<div class="post-metadata">

**Author:** ![A\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_b/32/17104_2.png) [@A\_B](https://discuss.elastic.co/u/A_B)\
**Post date:** [January 8, 2018, 11:13am UTC](https://discuss.elastic.co/t/delete-a-specific-type-from-an-index/114499/2 "2018-01-08T11:13:41Z")

</div>

I'm by no means an expert when it comes to this specific issue but as far as I know, you can't really do that (delete documents).

You would have to reindex and leave out that type. I have had very limited success with my own reindexing attempts so can't help you there but interested to see what people with more experience say.

---

<div class="post-metadata">

**Author:** ![A\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_b/32/17104_2.png) [@A\_B](https://discuss.elastic.co/u/A_B)\
**Post date:** [January 8, 2018, 12:21pm UTC](https://discuss.elastic.co/t/delete-a-specific-type-from-an-index/114499/3 "2018-01-08T12:21:18Z")

</div>

Got curious so looked at the API documentation.

@cilzzz, you probably need to use [https://www.elastic.co/guide/en/elasticsearch/reference/6.1/docs-delete-by-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.1/docs-delete-by-query.html)

Something like

```
POST twitter/_delete_by_query
{
  "query": { 
    "match": {
      "type": "mssql"
    }
  }
} 

```

Not exactly what you wanted to do. It _should_ remove all documents of `type: mssql` but the mapping will remain. To remove a mapping you would have to reindex.

---

<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:** [February 5, 2018, 12:21pm UTC](https://discuss.elastic.co/t/delete-a-specific-type-from-an-index/114499/4 "2018-02-05T12:21:43Z")

</div>

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