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

Close and open an Elasticsearch index

Will Button
InstructorWill Button
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated a year ago

Closing and opening indices on Elasticsearch allow you to free up resources in your cluster when they aren’t needed, preventing you from scaling or growing your cluster to support unused indices. In this lesson, you will see how easy it is to do both and learn to do so on your own indices.

[00:01] We can also close an index using the close API endpoint. That comes back as acknowledged equal to true. Now whenever we look at all of our indices, using the CAT interface, we can see the Simpsons index is still there, but now it's in a closed state, as well as it doesn't have a health status, because it's closed. When an index is closed, it consumes almost no resources on the Elasticsearch cluster.

[00:31] One useful application for closing indices is with logs. If you send all of your server logs to Elasticsearch, it can occupy quite a bit of resources, over time, that aren't necessary. You can have a rule where log indices remain open for seven days and are closed after that. This will improve the performance of your cluster, as logs from years ago aren't consuming resources.

[00:54] If they're even needed, they can be accessed by simply opening the correct index. The way we would do that would be another post operation to the Simpsons index, and this time call the open endpoint, send that. Now if we take a look at all of our indices again, the Simpsons index is back open.

egghead
egghead
~ 33 minutes 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