⚠️ 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

Social Share Links

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.

egghead
egghead
~ 34 seconds ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today