Files

3.0 KiB

layout, title, parent, nav_order, has_children, redirect_from
layout title parent nav_order has_children redirect_from
default CAT templates CAT APIs 70 false
/opensearch/rest-api/cat/cat-templates/

CAT Templates API

Introduced 1.0 {: .label .label-purple }

The CAT templates operation lists the names, patterns, order numbers, and version numbers of index templates.

Endpoints

GET /_cat/templates
GET /_cat/templates/{name}

Query parameters

The following table lists the available query parameters. All query parameters are optional.

Parameter Data type Description Default
cluster_manager_timeout String The amount of time allowed to establish a connection to the cluster manager node. N/A
format String A short version of the Accept header, such as json or yaml.
Valid values are: cbor, json, smile, text, and yaml.
text
h List A comma-separated list of column names to display. N/A
help Boolean Returns help information. false
limit Integer The maximum number of rows to return. Must be greater than 0. Applied after sorting (s). N/A
local Boolean Returns local information but does not retrieve the state from the cluster manager node. false
s List A comma-separated list of column names or column aliases to sort by. N/A
v Boolean Enables verbose mode, which displays column headers. false

Example requests

The following example request returns information about all templates:

{% capture step1_rest %} GET /_cat/templates?v {% endcapture %}

{% capture step1_python %}

response = client.cat.templates( params = { "v": "true" } )

{% endcapture %}

{% include code-block.html rest=step1_rest python=step1_python %}

If you want to get information for a specific template or pattern:

{% capture step1_rest %} GET /_cat/templates/<template_name_or_pattern> {% endcapture %}

{% capture step1_python %}

response = client.cat.templates( name = "<template_name_or_pattern>" )

{% endcapture %}

{% include code-block.html rest=step1_rest python=step1_python %}

Example response

name | index_patterns order version composed_of
tenant_template | [opensearch-dashboards*] | 0  |    

To learn more about index templates, see Index templates.

Required permissions

If you use the Security plugin, make sure you have the appropriate permissions: indices:admin/template/get.