---
type: api
title: Get legacy index templates
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-indices-get-template
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-indices-get-template
products:
  - Elasticsearch
---

# Get legacy index templates


deprecated

Availability:

## Paths

- `GET` `/_template/{name}`
- `GET` `/_template`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#bearerauth)

#### Path Parameters

- `name` (union Name | [] Name) — optional, leave it out to use `/_template`
  Comma-separated list of index template names used to limit the request.
Wildcard (`*`) expressions are supported.
To return all index templates, omit this parameter or use a value of `_all` or `*`.

## Description

Get information about one or more index templates.

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

## Required authorization

* Cluster privileges: `manage_index_templates`

[Learn more about templates](https://www.elastic.co/docs/manage-data/data-store/templates)

## Query String Parameters

- `flat_settings` (boolean · default: false)
  If `true`, returns settings in flat format.
- `local` (boolean · default: false) — deprecated
  If `true`, the request retrieves information from the local node only.
- `master_timeout` (string Duration · default: 30s)
  Period to wait for a connection to the master node.
If no response is received before the timeout expires, the request fails and returns an error.

## Response

`application/json`

Type: `map string to TemplateMapping`

## Code Examples

#### Console

```console
GET /_template/.monitoring-*
```

#### JavaScript

```javascript
const response = await client.indices.getTemplate({
  name: ".monitoring-*",
});
```

#### Python

```python
resp = client.indices.get_template(
    name=".monitoring-*",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_template/.monitoring-*" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.indices().getTemplate(g -> g
    .name(".monitoring-*")
);
```

#### C#

```c#
var response = await client.Indices
    .GetTemplateAsync(d1 => d1
        .Name(new[] { ".monitoring-*" })
    );
```

#### PHP

```php
$resp = $client->indices()->getTemplate([
    "name" => ".monitoring-*",
]);
```

#### Ruby

```ruby
response = client.indices.get_template(
  name: ".monitoring-*"
)
```

