2013-08-29 07:24:34 +08:00
[[indices-open-close]]
== Open / Close Index API
The open and close index APIs allow to close an index, and later on
opening it. A closed index has almost no overhead on the cluster (except
for maintaining its metadata), and is blocked for read/write operations.
A closed index can be opened which will then go through the normal
recovery process.
The REST endpoint is `/{index}/_close` and `/{index}/_open`. For
example:
[source,js]
--------------------------------------------------
2016-09-02 01:05:22 +08:00
POST /my_index/_close
2013-08-29 07:24:34 +08:00
2016-09-02 01:05:22 +08:00
POST /my_index/_open
2013-08-29 07:24:34 +08:00
--------------------------------------------------
2016-09-02 01:05:22 +08:00
// CONSOLE
// TEST[s/^/PUT my_index\n/]
2013-09-05 02:26:52 +08:00
It is possible to open and close multiple indices. An error will be thrown
if the request explicitly refers to a missing index. This behaviour can be
2013-12-12 07:30:12 +08:00
disabled using the `ignore_unavailable=true` parameter.
2013-09-05 02:26:52 +08:00
All indices can be opened or closed at once using `_all` as the index name
or specifying patterns that identify them all (e.g. `*`).
2014-01-05 01:54:17 +08:00
Identifying indices via wildcards or `_all` can be disabled by setting the
`action.destructive_requires_name` flag in the config file to `true`.
2015-10-17 04:10:51 +08:00
This setting can also be changed via the cluster update settings api.
2016-07-21 18:20:23 +08:00
Closed indices consume a significant amount of disk-space which can cause problems in managed environments. Closing indices can be disabled via the cluster settings
API by setting `cluster.indices.close.enable` to `false`. The default is `true`.
2017-09-22 17:15:03 +08:00
[float]
=== Wait For Active Shards
Because opening an index allocates its shards, the
<<create-index-wait-for-active-shards,`wait_for_active_shards`>> setting on
index creation applies to the index opening action as well.