|
| 1 | +[[indices-close]] |
| 2 | +=== Close index API |
| 3 | +++++ |
| 4 | +<titleabbrev>Close index</titleabbrev> |
| 5 | +++++ |
| 6 | + |
| 7 | +Closes an index. |
| 8 | + |
| 9 | +[source,js] |
| 10 | +-------------------------------------------------- |
| 11 | +POST /twitter/_close |
| 12 | +-------------------------------------------------- |
| 13 | +// CONSOLE |
| 14 | +// TEST[setup:twitter] |
| 15 | + |
| 16 | + |
| 17 | +[[close-index-api-request]] |
| 18 | +==== {api-request-title} |
| 19 | + |
| 20 | +`POST /<index>/_close` |
| 21 | + |
| 22 | + |
| 23 | +[[close-index-api-desc]] |
| 24 | +==== {api-description-title} |
| 25 | + |
| 26 | +You use the close index API to close open indices. |
| 27 | + |
| 28 | +include::{docdir}/indices/open-close.asciidoc[tag=closed-index] |
| 29 | + |
| 30 | + |
| 31 | +[[close-index-api-path-params]] |
| 32 | +==== {api-path-parms-title} |
| 33 | + |
| 34 | +include::{docdir}/rest-api/common-parms.asciidoc[tag=index] |
| 35 | ++ |
| 36 | +To close all indices, use `_all` or `*`. |
| 37 | +To disallow the closing of indices with `_all` or wildcard expressions, |
| 38 | +change the `action.destructive_requires_name` cluster setting to `true`. |
| 39 | +You can update this setting in the `elasticsearch.yml` file |
| 40 | +or using the <<cluster-update-settings,cluster update settings>> API. |
| 41 | + |
| 42 | + |
| 43 | +[[close-index-api-query-params]] |
| 44 | +==== {api-query-parms-title} |
| 45 | + |
| 46 | +include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices] |
| 47 | + |
| 48 | +include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards] |
| 49 | ++ |
| 50 | +Defaults to `open`. |
| 51 | + |
| 52 | +include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable] |
| 53 | + |
| 54 | +include::{docdir}/rest-api/common-parms.asciidoc[tag=doc-wait-for-active-shards] |
| 55 | + |
| 56 | +include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms] |
| 57 | + |
| 58 | + |
| 59 | +[[close-index-api-example]] |
| 60 | +==== {api-examples-title} |
| 61 | + |
| 62 | +The following example shows how to close an index: |
| 63 | + |
| 64 | +[source,js] |
| 65 | +-------------------------------------------------- |
| 66 | +POST /my_index/_close |
| 67 | +-------------------------------------------------- |
| 68 | +// CONSOLE |
| 69 | +// TEST[s/^/PUT my_index\n/] |
| 70 | + |
| 71 | +The API returns following response: |
| 72 | + |
| 73 | +[source,js] |
| 74 | +-------------------------------------------------- |
| 75 | +{ |
| 76 | + "acknowledged" : true, |
| 77 | + "shards_acknowledged" : true, |
| 78 | + "indices" : { |
| 79 | + "my_index" : { |
| 80 | + "closed" : true |
| 81 | + } |
| 82 | + } |
| 83 | +} |
| 84 | +-------------------------------------------------- |
| 85 | +// TESTRESPONSE |
0 commit comments