How to do it...

For opening and closing an index, we will perform the following steps:

  1. From the command line, we can execute a POST call to close an index using the following command:
POST /myindex/_close
  1. If the call is successful, the result returned by Elasticsearch should be as follows:
{
"acknowledged" : true
}
  1. To open an index from the command line, type the following command:
POST /myindex/_open
  1. If the call is successful, the result returned by Elasticsearch should be:
{
"acknowledged" : true,
"shards_acknowledged" : true
}