OpenSearch/docs/reference/cat/templates.asciidoc
Alexander Lin d31a8e6558 Provides a cat api endpoint for templates. (#20545)
Adds a cat api endpoint: /_cat/templates and its more specific version, /_cat/templates/{name}.

It looks something like:

$ curl "localhost:9200/_cat/templates?v"
name                  template     order version
sushi_california_roll *avocado*    1     1
pizza_hawaiian        *pineapples* 1
pizza_pepperoni       *pepperoni*  1

The specified version (only allows * globs) looks like:

$ curl "localhost:9200/_cat/templates/pizza*"
name            template     order version
pizza_hawaiian  *pineapples* 1
pizza_pepperoni *pepperoni*  1

Partially specified columns:

$ curl "localhost:9200/_cat/templates/pizza*?v=true&h=name,template"
name            template
pizza_hawaiian  *pineapples*
pizza_pepperoni *pepperoni*

The help text:

$ curl "localhost:9200/_cat/templates/pizza*?help"
name     | n | template name
template | t | template pattern string
order    | o | template application order number
version  | v | version

Closes #20467
2016-09-20 10:40:23 +02:00

21 lines
639 B
Plaintext

[[cat-templates]]
== cat templates
The `templates` command provides information about existing templates.
[source, sh]
--------------------------------------------------
% curl 'localhost:9200/_cat/templates?v=true'
name template order version
template0 te* 0
template1 tea* 1
template2 teak* 2 7
--------------------------------------------------
The output shows that there are three existing templates,
with template_2 having a version value.
The endpoint also supports giving a template name or pattern in the url
to filter the results, for example `/_cat/templates/template*` or
`/_cat/templates/template0`.