Skip to content

Commit b7c9138

Browse files
authored
[DOCS] Refactored index-templates topic. (#59737) (#60164)
* [DOCS] Refactored index-templates topic. * [DOCS] Add separate files. * [DOCS] Add delete component template. * Apply suggestions from code review Co-authored-by: James Rodewig <[email protected]> * [DOCS] Incorporated review comments
1 parent 608f3b4 commit b7c9138

16 files changed

+997
-584
lines changed

docs/reference/glossary.asciidoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ same cluster name. Each cluster has a single master node which is
2727
chosen automatically by the cluster and which can be replaced if the
2828
current master node fails.
2929

30+
[[glossary-component-template]] component template ::
31+
// tag::component-template-def[]
32+
A building block for constructing <<indices-templates,index templates>> that specifies index
33+
<<mapping,mappings>>, <<index-modules-settings,settings>>, and <<indices-aliases,aliases>>.
34+
// end::component-template-def[]
35+
3036
[[glossary-ccr]] {ccr} (CCR)::
3137

3238
The {ccr} feature enables you to replicate indices in remote clusters to your

docs/reference/index.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ include::setup.asciidoc[]
1919

2020
include::upgrade.asciidoc[]
2121

22+
include::indices/index-templates.asciidoc[]
23+
2224
include::data-streams/data-streams.asciidoc[]
2325

2426
include::search/index.asciidoc[]

docs/reference/indices.asciidoc

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,21 @@ index settings, aliases, mappings, and index templates.
4949
* <<indices-analyze>>
5050

5151
[discrete]
52-
[[index-templates]]
52+
[[index-templates-apis]]
5353
=== Index templates:
54-
* <<indices-templates>>
54+
55+
Index templates automatically apply settings, mappings, and aliases to new indices.
56+
They are most often used to configure rolling indices for time series data to
57+
ensure that each new index has the same configuration as the previous one.
58+
The index template associated with a data stream configures its backing indices.
59+
For more information, see <<indices-templates, Index Templates>>.
60+
5561
* <<indices-put-template>>
5662
* <<indices-get-template>>
5763
* <<indices-delete-template>>
5864
* <<indices-component-template>>
5965
* <<getting-component-templates>>
66+
* <<indices-delete-component-template>>
6067
* <<indices-template-exists>>
6168
* <<indices-simulate-index>>
6269
* <<indices-simulate-template>>
@@ -103,6 +110,8 @@ include::indices/delete-index.asciidoc[]
103110

104111
include::indices/delete-alias.asciidoc[]
105112

113+
include::indices/delete-component-template.asciidoc[]
114+
106115
include::indices/delete-index-template.asciidoc[]
107116

108117
include::indices/flush.asciidoc[]
@@ -111,6 +120,8 @@ include::indices/forcemerge.asciidoc[]
111120

112121
include::indices/apis/freeze.asciidoc[]
113122

123+
include::indices/get-component-template.asciidoc[]
124+
114125
include::indices/get-field-mapping.asciidoc[]
115126

116127
include::indices/get-index.asciidoc[]
@@ -121,6 +132,8 @@ include::indices/get-settings.asciidoc[]
121132

122133
include::indices/get-index-template.asciidoc[]
123134

135+
include::indices/get-index-template-v1.asciidoc[]
136+
124137
include::indices/get-mapping.asciidoc[]
125138

126139
include::indices/alias-exists.asciidoc[]
@@ -139,11 +152,11 @@ include::indices/template-exists.asciidoc[]
139152

140153
include::indices/open-close.asciidoc[]
141154

142-
include::indices/index-templates.asciidoc[]
155+
include::indices/put-index-template.asciidoc[]
143156

144-
include::indices/component-templates.asciidoc[]
157+
include::indices/put-index-template-v1.asciidoc[]
145158

146-
include::indices/templates.asciidoc[]
159+
include::indices/put-component-template.asciidoc[]
147160

148161
include::indices/put-mapping.asciidoc[]
149162

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[[indices-delete-component-template]]
2+
=== Delete component template API
3+
++++
4+
<titleabbrev>Delete component template</titleabbrev>
5+
++++
6+
7+
Deletes an existing component template.
8+
9+
////
10+
[source,console]
11+
--------------------------------------------------
12+
PUT _component_template/template_1
13+
{
14+
"template": {
15+
"settings": {
16+
"index.number_of_replicas": 0
17+
}
18+
}
19+
}
20+
--------------------------------------------------
21+
// TESTSETUP
22+
////
23+
24+
[source,console]
25+
--------------------------------------------------
26+
DELETE _component_template/template_1
27+
--------------------------------------------------
28+
29+
30+
[[delete-component-template-api-request]]
31+
==== {api-request-title}
32+
33+
`DELETE /_template/<component-template>`
34+
35+
36+
[[delete-component-template-api-desc]]
37+
==== {api-description-title}
38+
39+
Use the delete component template API to delete one or more component templates
40+
Component templates are building blocks for constructing <<indices-templates,index templates>>
41+
that specify index mappings, settings, and aliases.
42+
43+
[[delete-component-template-api-path-params]]
44+
==== {api-path-parms-title}
45+
46+
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=component-template]
47+
48+
49+
[[delete-component-template-api-query-params]]
50+
==== {api-query-parms-title}
51+
52+
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]

docs/reference/indices/delete-index-template.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<titleabbrev>Delete index template</titleabbrev>
55
++++
66

7-
Deletes an existing index.
7+
Deletes an index template.
88

99
////
1010
[source,console]
@@ -35,9 +35,9 @@ DELETE /_template/template_1
3535
[[delete-template-api-desc]]
3636
==== {api-description-title}
3737

38-
Use the delete index template API to delete one or more index templates
39-
40-
include::templates.asciidoc[tag=index-template-def]
38+
Use the delete index template API to delete one or more index templates.
39+
Index templates define <<index-modules-settings,settings>>, <<mapping,mappings>>,
40+
and <<indices-aliases,aliases>> that can be applied automatically to new indices.
4141

4242

4343
[[delete-template-api-path-params]]
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
[[getting-component-templates]]
2+
=== Get component template API
3+
++++
4+
<titleabbrev>Get component template</titleabbrev>
5+
++++
6+
7+
Retrieves information about one or more component templates.
8+
9+
//////////////////////////
10+
11+
[source,console]
12+
--------------------------------------------------
13+
PUT /_component_template/template_1
14+
{
15+
"template": {
16+
"settings": {
17+
"index.number_of_replicas": 0
18+
},
19+
"mappings": {
20+
"properties": {
21+
"@timestamp": {
22+
"type": "date"
23+
}
24+
}
25+
}
26+
}
27+
}
28+
--------------------------------------------------
29+
// TESTSETUP
30+
31+
[source,console]
32+
--------------------------------------------------
33+
DELETE /_component_template/template_*
34+
--------------------------------------------------
35+
// TEARDOWN
36+
37+
//////////////////////////
38+
39+
[source,console]
40+
--------------------------------------------------
41+
GET /_component_template/template_1
42+
--------------------------------------------------
43+
44+
[[get-component-template-api-request]]
45+
==== {api-request-title}
46+
47+
`GET /_component-template/<component-template>`
48+
49+
50+
[[get-component-template-api-path-params]]
51+
==== {api-path-parms-title}
52+
53+
`<component-template>`
54+
(Optional, string)
55+
Comma-separated list of component template names used to limit the request.
56+
Wildcard (`*`) expressions are supported.
57+
58+
59+
[[get-component-template-api-query-params]]
60+
==== {api-query-parms-title}
61+
62+
include::{docdir}/rest-api/common-parms.asciidoc[tag=flat-settings]
63+
64+
include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
65+
66+
include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
67+
68+
69+
[[get-component-template-api-example]]
70+
==== {api-examples-title}
71+
72+
73+
[[get-component-template-api-wildcard-ex]]
74+
===== Get component templates using a wildcard expression
75+
76+
[source,console]
77+
--------------------------------------------------
78+
GET /_component_template/temp*
79+
--------------------------------------------------
80+
81+
82+
[[get-component-template-api-all-ex]]
83+
===== Get all component templates
84+
85+
[source,console]
86+
--------------------------------------------------
87+
GET /_component_template
88+
--------------------------------------------------
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
[[indices-get-template-v1]]
2+
=== Get index template API
3+
++++
4+
<titleabbrev>Get index template (legacy)</titleabbrev>
5+
++++
6+
7+
IMPORTANT: This documentation is about legacy index templates,
8+
which are deprecated and will be replaced by the composable templates introduced in {es} 7.8.
9+
For information about composable templates, <<indices-templates>>.
10+
11+
Retrieves information about one or more index templates.
12+
13+
////
14+
[source,console]
15+
--------------------------------------------------
16+
PUT _template/template_1
17+
{
18+
"index_patterns" : ["te*"],
19+
"settings": {
20+
"number_of_shards": 1
21+
}
22+
}
23+
--------------------------------------------------
24+
// TESTSETUP
25+
26+
[source,console]
27+
--------------------------------------------------
28+
DELETE _template/template_1
29+
--------------------------------------------------
30+
// TEARDOWN
31+
32+
////
33+
34+
[source,console]
35+
--------------------------------------------------
36+
GET /_template/template_1
37+
--------------------------------------------------
38+
39+
40+
[[get-template-v1-api-request]]
41+
==== {api-request-title}
42+
43+
`GET /_template/<index-template>`
44+
45+
46+
[[get-template-v1-api-path-params]]
47+
==== {api-path-parms-title}
48+
49+
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-template]
50+
+
51+
To return all index templates, omit this parameter
52+
or use a value of `_all` or `*`.
53+
54+
55+
[[get-template-v1-api-query-params]]
56+
==== {api-query-parms-title}
57+
58+
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=flat-settings]
59+
60+
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
61+
62+
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
63+
64+
65+
[[get-template-v1-api-example]]
66+
==== {api-examples-title}
67+
68+
69+
[[get-template-v1-api-multiple-ex]]
70+
===== Get multiple index templates
71+
72+
[source,console]
73+
--------------------------------------------------
74+
GET /_template/template_1,template_2
75+
--------------------------------------------------
76+
77+
78+
[[get-template-v1-api-wildcard-ex]]
79+
===== Get index templates using a wildcard expression
80+
81+
[source,console]
82+
--------------------------------------------------
83+
GET /_template/temp*
84+
--------------------------------------------------
85+
86+
87+
[[get-template-v1-api-all-ex]]
88+
===== Get all index templates
89+
90+
[source,console]
91+
--------------------------------------------------
92+
GET /_template
93+
--------------------------------------------------

0 commit comments

Comments
 (0)