Skip to content

Commit 5e682a0

Browse files
committed
[DOCS] Add "get index template" API docs (#46296)
1 parent d118d0b commit 5e682a0

File tree

3 files changed

+95
-27
lines changed

3 files changed

+95
-27
lines changed

docs/reference/indices.asciidoc

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ index settings, aliases, mappings, and index templates.
5151
[[index-templates]]
5252
=== Index templates:
5353
* <<indices-delete-template>>
54+
* <<indices-get-template>>
5455
* <<indices-template-exists>>
5556
* <<indices-templates>>
5657

@@ -120,6 +121,8 @@ include::indices/analyze.asciidoc[]
120121

121122
include::indices/delete-index-template.asciidoc[]
122123

124+
include::indices/get-index-template.asciidoc[]
125+
123126
include::indices/template-exists.asciidoc[]
124127

125128
include::indices/templates.asciidoc[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
[[indices-get-template]]
2+
=== Get index template API
3+
++++
4+
<titleabbrev>Get template index</titleabbrev>
5+
++++
6+
7+
Returns information about one or more index templates.
8+
9+
////
10+
[source,js]
11+
--------------------------------------------------
12+
PUT _template/template_1
13+
{
14+
"index_patterns" : ["te*"],
15+
"settings": {
16+
"number_of_shards": 1
17+
}
18+
}
19+
--------------------------------------------------
20+
// CONSOLE
21+
// TESTSETUP
22+
////
23+
24+
[source,js]
25+
--------------------------------------------------
26+
GET /_template/template_1
27+
--------------------------------------------------
28+
// CONSOLE
29+
30+
31+
[[get-template-api-request]]
32+
==== {api-request-title}
33+
34+
`GET /_template/<index-template>`
35+
36+
37+
[[get-template-api-path-params]]
38+
==== {api-path-parms-title}
39+
40+
include::{docdir}/rest-api/common-parms.asciidoc[tag=index-template]
41+
+
42+
To return all index templates, omit this parameter
43+
or use a value of `_all` or `*`.
44+
45+
46+
[[get-template-api-query-params]]
47+
==== {api-query-parms-title}
48+
49+
include::{docdir}/rest-api/common-parms.asciidoc[tag=flat-settings]
50+
51+
include::{docdir}/rest-api/common-parms.asciidoc[tag=include-type-name]
52+
53+
include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
54+
55+
include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
56+
57+
58+
[[get-template-api-example]]
59+
==== {api-examples-title}
60+
61+
62+
[[get-template-api-multiple-ex]]
63+
===== Get multiple index templates
64+
65+
[source,js]
66+
--------------------------------------------------
67+
GET /_template/template_1,template_2
68+
--------------------------------------------------
69+
// CONSOLE
70+
71+
72+
[[get-template-api-wildcard-ex]]
73+
===== Get index templates using a wildcard expression
74+
75+
[source,js]
76+
--------------------------------------------------
77+
GET /_template/temp*
78+
--------------------------------------------------
79+
// CONSOLE
80+
81+
82+
[[get-template-api-all-ex]]
83+
===== Get all index templates
84+
85+
[source,js]
86+
--------------------------------------------------
87+
GET /_template
88+
--------------------------------------------------
89+
// CONSOLE

docs/reference/indices/templates.asciidoc

+3-27
Original file line numberDiff line numberDiff line change
@@ -90,35 +90,11 @@ DELETE /_template/template_1
9090
--------------------------------------------------
9191
// CONSOLE
9292

93-
[float]
94-
[[getting]]
93+
[float]
94+
[[getting]]
9595
==== Getting templates
9696

97-
Index templates are identified by a name (in the above case
98-
`template_1`) and can be retrieved using the following:
99-
100-
[source,js]
101-
--------------------------------------------------
102-
GET /_template/template_1
103-
--------------------------------------------------
104-
// CONSOLE
105-
106-
You can also match several templates by using wildcards like:
107-
108-
[source,js]
109-
--------------------------------------------------
110-
GET /_template/temp*
111-
GET /_template/template_1,template_2
112-
--------------------------------------------------
113-
// CONSOLE
114-
115-
To get list of all index templates you can run:
116-
117-
[source,js]
118-
--------------------------------------------------
119-
GET /_template
120-
--------------------------------------------------
121-
// CONSOLE
97+
See <<indices-get-template>>.
12298

12399
[float]
124100
[[multiple-templates]]

0 commit comments

Comments
 (0)