How do I delete a single type, rather than a whole index?

Hi.

The Definitive Guide explains how you can easily delete an entire index (DELETE /my_index) but not a single type.

I assumed DELETE /my_index/my_type would work, but it doesn't.

I can delete each document individually (DELETE /my_index/my_type/my_id) but that's a pain and very inefficient.

I'm in pre-production and I want to delete a particular type, rather than the whole index, so that I can set up the mappings correctly.

Thanks and kind regards
Randall

Hi Randall,

I've moved the post to the Elasticsearch channel as this is related to Elasticsearch core product rather than Elastic Cloud.

You might want to take a look at https://www.elastic.co/guide/en/elasticsearch/reference/1.7/indices-delete-mapping.html or https://www.elastic.co/guide/en/elasticsearch/reference/2.2/indices-delete-mapping.html depending on the version of Elasticsearch you are running.

Christian

Hi Christian

I'm using Elastic Cloud and I've already searched the Elasticsearch channel, without success. The most relevant post I found there said the solution was to run some sort of delete query, but it was first necessary to download and install some additional software. That's obviously not an option for me given I'm using Elastic Cloud. I tried running the suggested delete query using my Kopf dashboard in the hope that the relevant software was already available on Elastic Cloud, also without success.

Surely if I can delete an entire index and a single document, there's a simple way to bulk delete all documents of a particular type!

Thanks and kind regards
Randall

Hi Randall,

You have the option of using the delete-by-query plugin from within the Elastic Cloud console.

For more in-depth advice to help you with your elasticsearch usage in Elastic Cloud, take a look at our Cloud Premium offerings that offer SLA-based support. Get started with Cloud Premium today by contacting Elastic..

Regards,
Christian

Learn More from the Cloud Team:

Hi Christian

It seems that plugins are only available to Cloud Premium customers.

Given that it is possible to delete an index, not being able to delete a type without a plugin seems to be a rather glaring omission in this product.

Providing a solution, but only making it available to premium customers for an additional fee is rather disappointing because it forces me to pay for support that I don't need.

So now I have to delete the whole index, including every type, and replace everything. And to avoid this happening again I will have to set up a separate index for each type, which is not ideal.

A better solution would of course be for Elastic Cloud to either include this particular plugin as standard or expand the existing delete capability to include specified types!

Thanks and kind regards
Randall