2016-09-20 04:40:23 -04:00
|
|
|
[[cat-templates]]
|
2019-08-13 08:35:08 -04:00
|
|
|
=== cat templates API
|
|
|
|
++++
|
|
|
|
<titleabbrev>cat templates</titleabbrev>
|
|
|
|
++++
|
2016-09-20 04:40:23 -04:00
|
|
|
|
2019-08-12 08:45:28 -04:00
|
|
|
Returns information about <<indices-templates,index templates>> in a cluster.
|
|
|
|
You can use index templates to apply <<index-modules-settings,index settings>>
|
|
|
|
and <<mapping,field mappings>> to new indices at creation.
|
|
|
|
|
|
|
|
|
|
|
|
[[cat-templates-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
2019-08-23 10:57:20 -04:00
|
|
|
`GET /_cat/templates/<template_name>`
|
2019-08-12 08:45:28 -04:00
|
|
|
|
2019-10-10 09:48:40 -04:00
|
|
|
`GET /_cat/templates`
|
|
|
|
|
2019-08-12 08:45:28 -04:00
|
|
|
|
|
|
|
[[cat-templates-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
2019-08-23 10:57:20 -04:00
|
|
|
`<template_name>`::
|
2019-08-12 08:45:28 -04:00
|
|
|
(Optional, string) Comma-separated list of index template names used to limit
|
|
|
|
the request. Accepts wildcard expressions.
|
|
|
|
|
|
|
|
|
|
|
|
[[cat-templates-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=http-format]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-h]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=help]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-s]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-v]
|
|
|
|
|
|
|
|
|
|
|
|
[[cat-templates-api-example]]
|
|
|
|
==== {api-examples-title}
|
2016-09-20 04:40:23 -04:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2016-09-20 04:40:23 -04:00
|
|
|
--------------------------------------------------
|
2017-05-03 20:58:23 -04:00
|
|
|
GET /_cat/templates?v&s=name
|
2016-09-20 04:40:23 -04:00
|
|
|
--------------------------------------------------
|
2018-06-18 12:06:42 -04:00
|
|
|
// TEST[s/templates/templates\/template*/]
|
2017-05-03 20:58:23 -04:00
|
|
|
// TEST[s/^/PUT _template\/template0\n{"index_patterns": "te*", "order": 0}\n/]
|
|
|
|
// TEST[s/^/PUT _template\/template1\n{"index_patterns": "tea*", "order": 1}\n/]
|
|
|
|
// TEST[s/^/PUT _template\/template2\n{"index_patterns": "teak*", "order": 2, "version": 7}\n/]
|
2019-01-07 08:44:12 -05:00
|
|
|
// The substitutions do two things:
|
2018-06-18 12:06:42 -04:00
|
|
|
// 1. Filter the response to just templates matching the te* pattern
|
|
|
|
// so that we only get the templates we expect regardless of which
|
|
|
|
// templates exist. If xpack is installed there will be unexpected
|
|
|
|
// templates.
|
|
|
|
// 2. Create some templates to expect in the response.
|
2017-05-03 20:58:23 -04:00
|
|
|
|
2019-08-12 08:45:28 -04:00
|
|
|
The API returns the following response:
|
2017-05-03 20:58:23 -04:00
|
|
|
|
|
|
|
[source,txt]
|
|
|
|
--------------------------------------------------
|
|
|
|
name index_patterns order version
|
|
|
|
template0 [te*] 0
|
|
|
|
template1 [tea*] 1
|
|
|
|
template2 [teak*] 2 7
|
|
|
|
--------------------------------------------------
|
2019-06-10 09:33:32 -04:00
|
|
|
// TESTRESPONSE[s/\*/\\*/ s/\[/\\[/ s/\]/\\]/ non_json]
|