82 lines
2.2 KiB
Plaintext
82 lines
2.2 KiB
Plaintext
[[cat-templates]]
|
|
=== cat templates API
|
|
++++
|
|
<titleabbrev>cat templates</titleabbrev>
|
|
++++
|
|
|
|
Returns information about <<index-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-api-prereqs]]
|
|
==== {api-prereq-title}
|
|
|
|
* If the {es} {security-features} are enabled, you must have the `monitor` or
|
|
`manage` <<privileges-list-cluster,cluster privilege>> to use this API.
|
|
|
|
[[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::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=http-format]
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
|
|
|
|
|
|
[[cat-templates-api-example]]
|
|
==== {api-examples-title}
|
|
|
|
[source,console]
|
|
----
|
|
GET _cat/templates/my-template-*?v=true&s=name
|
|
----
|
|
// TEST[s/^/PUT _index_template\/my-template-0\n{"index_patterns": "te*", "priority": 500}\n/]
|
|
// TEST[s/^/PUT _index_template\/my-template-1\n{"index_patterns": "tea*", "priority": 501}\n/]
|
|
// TEST[s/^/PUT _index_template\/my-template-2\n{"index_patterns": "teak*", "priority": 502, "version": 7}\n/]
|
|
|
|
The API returns the following response:
|
|
|
|
[source,txt]
|
|
----
|
|
name index_patterns order version composed_of
|
|
my-template-0 [te*] 500 []
|
|
my-template-1 [tea*] 501 []
|
|
my-template-2 [teak*] 502 7 []
|
|
----
|
|
// TESTRESPONSE[s/\*/\\*/ s/\[/\\[/ s/\]/\\]/ non_json]
|
|
|
|
////
|
|
[source,console]
|
|
----
|
|
DELETE _index_template/my-template-0
|
|
DELETE _index_template/my-template-1
|
|
DELETE _index_template/my-template-2
|
|
----
|
|
// TEST[continued]
|
|
////
|