2019-08-27 12:31:53 -04:00
|
|
|
[[indices-close]]
|
|
|
|
=== Close index API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Close index</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
|
|
|
Closes an index.
|
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2019-08-27 12:31:53 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
POST /twitter/_close
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[setup:twitter]
|
|
|
|
|
|
|
|
|
|
|
|
[[close-index-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
`POST /<index>/_close`
|
|
|
|
|
|
|
|
|
|
|
|
[[close-index-api-desc]]
|
|
|
|
==== {api-description-title}
|
|
|
|
|
|
|
|
You use the close index API to close open indices.
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/indices/open-close.asciidoc[tag=closed-index]
|
2019-08-27 12:31:53 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[close-index-api-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
|
2019-08-27 12:31:53 -04:00
|
|
|
+
|
|
|
|
To close all indices, use `_all` or `*`.
|
|
|
|
To disallow the closing of indices with `_all` or wildcard expressions,
|
|
|
|
change the `action.destructive_requires_name` cluster setting to `true`.
|
|
|
|
You can update this setting in the `elasticsearch.yml` file
|
|
|
|
or using the <<cluster-update-settings,cluster update settings>> API.
|
|
|
|
|
|
|
|
|
|
|
|
[[close-index-api-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
|
2020-02-24 05:57:32 -05:00
|
|
|
+
|
|
|
|
Defaults to `true`.
|
2019-08-27 12:31:53 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
|
2019-08-27 12:31:53 -04:00
|
|
|
+
|
|
|
|
Defaults to `open`.
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
|
2019-08-27 12:31:53 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards]
|
2019-08-27 12:31:53 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
|
2019-08-27 12:31:53 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[close-index-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
The following example shows how to close an index:
|
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2019-08-27 12:31:53 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
POST /my_index/_close
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[s/^/PUT my_index\n/]
|
|
|
|
|
|
|
|
The API returns following response:
|
|
|
|
|
2019-09-06 09:22:08 -04:00
|
|
|
[source,console-result]
|
2019-08-27 12:31:53 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"acknowledged" : true,
|
|
|
|
"shards_acknowledged" : true,
|
|
|
|
"indices" : {
|
|
|
|
"my_index" : {
|
|
|
|
"closed" : true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|