This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Autoplay

    Delete an index using the Elasticsearch API

    Will ButtonWill Button

    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.

    elasticsearchelasticsearch
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    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.

    Discuss

    Discuss