⚠️ This lesson is retired and might contain outdated information.

Delete an index using the Elasticsearch API

Will Button
InstructorWill Button

Share this video with your friends

Send Tweet
Published 7 years ago
Updated a year ago

In this lesson, you will learn how to delete a single index, multiple indices, or all indices on your Elasticsearch cluster. We’ll see how a simple DELETE request can delete any index you like.

[00:01] Deleting an index is probably the easiest thing to do in all of Elasticsearch, which may or may not be a good thing. If I take a look at all of the indices on my cluster, I can delete them by using a delete operation, specify the cluster and then specify the index that I want to delete.

[00:23] Not only can I specify an individual index, I can comma separate a list of indexes or indices. I can also use wildcards, for example, delete all indices that start with the letter "W" or a blanket wildcard that deletes all indexes period. I don't want to delete everything, but I wouldn't mind deleting the [inaudible] index. When I do that, Elasticsearch comes back and acknowledges that.

[00:51] If I list it again, it's no longer there. One other thing about deleting is you may recall that, so far, we have two different mapping types in our Simpson's index. We have the episodes and the scripts. You can't target a specific document type, so if I wanted to get rid of the episodes type in the Simpson's index, I can't do that.

[01:14] I have to delete the Simpson's index as a whole which deletes both document types and then re-index the data that I do want.