Skip to content

Commit d7ef0e2

Browse files
committed
[DOCS] Separate and reformat close index API docs (#45922)
1 parent 9067a47 commit d7ef0e2

File tree

3 files changed

+90
-2
lines changed

3 files changed

+90
-2
lines changed

docs/reference/indices.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ index settings, aliases, mappings, and index templates.
1212
* <<indices-delete-index>>
1313
* <<indices-get-index>>
1414
* <<indices-exists>>
15+
* <<indices-close>>
1516
* <<indices-open-close>>
1617
* <<indices-shrink-index>>
1718
* <<indices-split-index>>
@@ -66,6 +67,8 @@ include::indices/get-index.asciidoc[]
6667

6768
include::indices/indices-exists.asciidoc[]
6869

70+
include::indices/close.asciidoc[]
71+
6972
include::indices/open-close.asciidoc[]
7073

7174
include::indices/shrink-index.asciidoc[]
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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

docs/reference/indices/open-close.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ POST /twitter/_open
2626

2727
You use the open index API to re-open closed indices.
2828

29-
// tag:closed-index
29+
// tag::closed-index[]
3030

3131
A closed index is blocked for read/write operations and does not allow
3232
all operations that opened indices allow. It is not possible to index
@@ -62,7 +62,7 @@ Because opening or closing an index allocates its shards, the
6262
<<create-index-wait-for-active-shards,`wait_for_active_shards`>> setting on
6363
index creation applies to the `_open` and `_close` index actions as well.
6464

65-
// end:closed-index
65+
// end::closed-index[]
6666

6767

6868
[[open-index-api-path-params]]

0 commit comments

Comments
 (0)