---
type: api
title: Get auto-follow patterns
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-ccr-get-auto-follow-pattern
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-ccr-get-auto-follow-pattern
products:
  - Elasticsearch
---

# Get auto-follow patterns


Availability: 6.5+

## Paths

- `GET` `/_ccr/auto_follow/{name}`
- `GET` `/_ccr/auto_follow`

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

#### Path Parameters

- `name` (string Name) — optional, leave it out to use `/_ccr/auto_follow`
  The auto-follow pattern collection that you want to retrieve.
If you do not specify a name, the API returns information for all collections.

## Description

Get cross-cluster replication auto-follow patterns.

## Required authorization

* Cluster privileges: `manage_ccr`

[More about auto-follow patterns](https://www.elastic.co/docs/deploy-manage/tools/cross-cluster-replication/manage-auto-follow-patterns)

## Query String Parameters

- `master_timeout` (string Duration · default: 30s)
  The period to wait for a connection to the master node.
If the master node is not available before the timeout expires, the request fails and returns an error.
It can also be set to `-1` to indicate that the request should never timeout.

## Response

`application/json`

- `patterns` ([] AutoFollowPattern)
  - `name` (string Name)
  - `pattern` ({} AutoFollowPatternSummary)
    - `active` (boolean)
    - `remote_cluster` (string)
      The remote cluster containing the leader indices to match against.
    - `follow_index_pattern` (string)
      The name of follower index.
    - `leader_index_patterns` (IndexPatterns)
      An array of simple index patterns to match against indices in the remote cluster specified by the remote_cluster field.
    - `leader_index_exclusion_patterns` (IndexPatterns)
      An array of simple index patterns that can be used to exclude indices from being auto-followed.
    - `max_outstanding_read_requests` (number)
      The maximum number of outstanding reads requests from the remote cluster.
## Code Examples

#### Console

```console
GET /_ccr/auto_follow/my_auto_follow_pattern
```

#### JavaScript

```javascript
const response = await client.ccr.getAutoFollowPattern({
  name: "my_auto_follow_pattern",
});
```

#### Python

```python
resp = client.ccr.get_auto_follow_pattern(
    name="my_auto_follow_pattern",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.ccr().getAutoFollowPattern(g -> g
    .name("my_auto_follow_pattern")
);
```

#### C#

```c#
var response = await client.CrossClusterReplication
    .GetAutoFollowPatternAsync(d1 => d1
        .Name("my_auto_follow_pattern")
    );
```

#### PHP

```php
$resp = $client->ccr()->getAutoFollowPattern([
    "name" => "my_auto_follow_pattern",
]);
```

#### Ruby

```ruby
response = client.ccr.get_auto_follow_pattern(
  name: "my_auto_follow_pattern"
)
```

## Response Examples

#### Get auto follow pattern response example1

A successful response from `GET /_ccr/auto_follow/my_auto_follow_pattern`, which gets auto-follow patterns.

```json
{
  "patterns": [
    {
      "name": "my_auto_follow_pattern",
      "pattern": {
        "active": true,
        "remote_cluster" : "remote_cluster",
        "leader_index_patterns" :
        [
          "leader_index*"
        ],
        "leader_index_exclusion_patterns":
        [
          "leader_index_001"
        ],
        "follow_index_pattern" : "{{leader_index}}-follower"
      }
    }
  ]
}
```

