He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!
Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. Elasticsearch is developed in Java.
In this document, we will show how to open and close the indexes. Here is one of the uses where you might need to open and close the indexes. let’s assume that you are restoring elasticsearch snapshots from the repository using a curator. If you don’t know how to backup and restore elasticsearch data, then check out this link. how to backup and restore elasticsearch indexes using curator
So during restoration, we have to ensure that the restoring index is opened. If it is opened Elasticsearch won’t allow writing data to the indexes. So we need to close it. and Once the data is restored we have to make sure that the same index needs to be opened otherwise the data cannot read from the index.
I hope you understand this simple use case.
Now let’s see how to perform the same.
Note: Expected output for all the command is acknowledged: true
Close a particular index.
The above command will close the index named nginx-access-logs
The expected output is acknowledged: true
Open a particular index
The above command will open the index named nginx-access-logs
close indexes based on pattern
this closes the indexes which have the pattern nginx-*
open indexes based on pattern
this opens the indexes which have the pattern nginx-*
Close all the indexes in the Elasticsearch
Open all the indexes in the Elasticsearch
Delete the indexes
Delete the indexes based on pattern
© 2020, Techrunnr. All rights reserved.