86 lines
2.5 KiB
Plaintext
86 lines
2.5 KiB
Plaintext
[[cat-templates]]
|
|
=== cat templates API
|
|
++++
|
|
<titleabbrev>cat templates</titleabbrev>
|
|
++++
|
|
|
|
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}
|
|
|
|
`GET /_cat/templates/<template_name>`
|
|
|
|
`GET /_cat/templates`
|
|
|
|
|
|
[[cat-templates-path-params]]
|
|
==== {api-path-parms-title}
|
|
|
|
`<template_name>`::
|
|
(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}
|
|
|
|
[source,console]
|
|
--------------------------------------------------
|
|
GET /_cat/templates?v&s=name
|
|
--------------------------------------------------
|
|
// TEST[s/templates/templates\/template*/]
|
|
// 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/]
|
|
// The substitutions do two things:
|
|
// 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.
|
|
|
|
The API returns the following response:
|
|
|
|
[source,txt]
|
|
--------------------------------------------------
|
|
name index_patterns order version
|
|
template0 [te*] 0
|
|
template1 [tea*] 1
|
|
template2 [teak*] 2 7
|
|
--------------------------------------------------
|
|
// TESTRESPONSE[s/\*/\\*/ s/\[/\\[/ s/\]/\\]/ non_json]
|
|
|
|
//////////////////////////
|
|
|
|
[source,console]
|
|
--------------------------------------------------
|
|
DELETE /_template/template0
|
|
DELETE /_template/template1
|
|
DELETE /_template/template2
|
|
--------------------------------------------------
|
|
// TEST[continued]
|
|
|
|
//////////////////////////
|