`leader_alias` | The name of the cross-cluster connection. You define this alias when you [set up a cross-cluster connection]({{site.url}}{{site.baseurl}}/replication-plugin/get-started/#set-up-a-cross-cluster-connection). | `string` | Yes
`leader_index` | The index on the leader cluster that you want to replicate. | `string` | Yes
`use_roles` | The roles to use for all subsequent backend replication tasks between the indices. Specify a `leader_cluster_role` and `follower_cluster_role`. See [Map the leader and follower cluster roles]({{site.url}}{{site.baseurl}}/replication-plugin/permissions/#map-the-leader-and-follower-cluster-roles). | `string` | If security plugin is enabled
You can't resume replication after it's been paused for more than 12 hours. You must [stop replication]({{site.url}}{{site.baseurl}}/replication-plugin/api/#stop-replication), delete the follower index, and restart replication of the leader.
Gets the status of index replication. Possible statuses are `SYNCING`, `BOOTSTRAPING`, `PAUSED`, and `REPLICATION NOT IN PROGRESS`. Use the syncing details to measure replication lag. Send this request to the follower cluster.
The leader and follower checkpoint values begin as negative integers and reflect the shard count (-1 for one shard, -5 for five shards, and so on). The values increment toward positive integers with each change that you make. For example, when you make a change on the leader index, the `leader_checkpoint` becomes `0`. The `follower_checkpoint` is initially still `-1` until the follower index pulls the change from the leader, at which point it increments to `0`. If the values are the same, it means the indices are fully synced.
## Get leader cluster stats
Introduced 1.1
{: .label .label-purple }
Gets information about replicated leader indices on a specified cluster.
#### Request
```json
GET/_plugins/_replication/leader_stats
```
#### Sample response
```json
{
"num_replicated_indices":2,
"operations_read":15,
"translog_size_bytes":1355,
"operations_read_lucene":0,
"operations_read_translog":15,
"total_read_time_lucene_millis":0,
"total_read_time_translog_millis":659,
"bytes_read":1000,
"index_stats":{
"leader-index-1":{
"operations_read":7,
"translog_size_bytes":639,
"operations_read_lucene":0,
"operations_read_translog":7,
"total_read_time_lucene_millis":0,
"total_read_time_translog_millis":353,
"bytes_read":466
},
"leader-index-2":{
"operations_read":8,
"translog_size_bytes":716,
"operations_read_lucene":0,
"operations_read_translog":8,
"total_read_time_lucene_millis":0,
"total_read_time_translog_millis":306,
"bytes_read":534
}
}
}
```
## Get follower cluster stats
Introduced 1.1
{: .label .label-purple }
Gets information about follower (syncing) indices on a specified cluster.
#### Request
```json
GET/_plugins/_replication/follower_stats
```
#### Sample response
```json
{
"num_syncing_indices":2,
"num_bootstrapping_indices":0,
"num_paused_indices":0,
"num_failed_indices":0,
"num_shard_tasks":2,
"num_index_tasks":2,
"operations_written":3,
"operations_read":3,
"failed_read_requests":0,
"throttled_read_requests":0,
"failed_write_requests":0,
"throttled_write_requests":0,
"follower_checkpoint":1,
"leader_checkpoint":1,
"total_write_time_millis":2290,
"index_stats":{
"follower-index-1":{
"operations_written":2,
"operations_read":2,
"failed_read_requests":0,
"throttled_read_requests":0,
"failed_write_requests":0,
"throttled_write_requests":0,
"follower_checkpoint":1,
"leader_checkpoint":1,
"total_write_time_millis":1355
},
"follower-index-2":{
"operations_written":1,
"operations_read":1,
"failed_read_requests":0,
"throttled_read_requests":0,
"failed_write_requests":0,
"throttled_write_requests":0,
"follower_checkpoint":0,
"leader_checkpoint":0,
"total_write_time_millis":935
}
}
}
```
## Get auto-follow stats
Introduced 1.1
{: .label .label-purple }
Gets information about auto-follow activity and any replication rules configured on the specified cluster.
Automatically starts replication on indices matching a specified pattern. If a new index on the leader cluster matches the pattern, OpenSearch automatically creates a follower index and begins replication. You can also use this API to update existing replication rules.
Make sure to note the names of all auto-follow patterns after you create them. The replication plugin currently does not include an API operation to retrieve a list of existing patterns.
`leader_alias` | The name of the cross-cluster connection. You define this alias when you [set up a cross-cluster connection]({{site.url}}{{site.baseurl}}/replication-plugin/get-started/#set-up-a-cross-cluster-connection). | `string` | Yes
`name` | A name for the auto-follow pattern. | `string` | Yes
`pattern` | An array of index patterns to match against indices in the specified leader cluster. Supports wildcard characters. For example, `leader-*`. | `string` | Yes
`use_roles` | The roles to use for all subsequent backend replication tasks between the indices. Specify a `leader_cluster_role` and `follower_cluster_role`. See [Map the leader and follower cluster roles]({{site.url}}{{site.baseurl}}/replication-plugin/permissions/#map-the-leader-and-follower-cluster-roles). | `string` | If security plugin is enabled
#### Sample response
```json
{
"acknowledged":true
}
```
## Delete replication rule
Introduced 1.1
{: .label .label-purple }
Deletes the specified replication rule. This operation prevents any new indices from being replicated but does not stop existing replication that the rule has already initiated.
`leader_alias` | The name of the cross-cluster connection. You define this alias when you [set up a cross-cluster connection]({{site.url}}{{site.baseurl}}/replication-plugin/get-started/#set-up-a-cross-cluster-connection). | `string` | Yes