Cross-Cluster Replication (CCR)

class elasticsearch.client.CcrClient(client)
Parameters:

client (BaseClient)

delete_auto_follow_pattern(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes auto-follow patterns.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-delete-auto-follow-pattern.html

Parameters:
  • name (str) – The name of the auto follow pattern.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

follow(*, index, error_trace=None, filter_path=None, human=None, leader_index=None, max_outstanding_read_requests=None, max_outstanding_write_requests=None, max_read_request_operation_count=None, max_read_request_size=None, max_retry_delay=None, max_write_buffer_count=None, max_write_buffer_size=None, max_write_request_operation_count=None, max_write_request_size=None, pretty=None, read_poll_timeout=None, remote_cluster=None, wait_for_active_shards=None, body=None)

Creates a new follower index configured to follow the referenced leader index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-put-follow.html

Parameters:
  • index (str) – The name of the follower index

  • leader_index (str | None)

  • max_outstanding_read_requests (int | None)

  • max_outstanding_write_requests (int | None)

  • max_read_request_operation_count (int | None)

  • max_read_request_size (str | None)

  • max_retry_delay (str | Literal[-1] | ~typing.Literal[0] | None)

  • max_write_buffer_count (int | None)

  • max_write_buffer_size (str | None)

  • max_write_request_operation_count (int | None)

  • max_write_request_size (str | None)

  • read_poll_timeout (str | Literal[-1] | ~typing.Literal[0] | None)

  • remote_cluster (str | None)

  • wait_for_active_shards (int | str | Literal['all', 'index-setting'] | None) – Sets the number of shard copies that must be active before returning. Defaults to 0. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

  • body (Dict[str, Any] | None)

Return type:

ObjectApiResponse[Any]

follow_info(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves information about all follower indices, including parameters and status for each follower index

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-get-follow-info.html

Parameters:
  • index (str | Sequence[str]) – A comma-separated list of index patterns; use _all to perform the operation on all indices

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

follow_stats(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-get-follow-stats.html

Parameters:
  • index (str | Sequence[str]) – A comma-separated list of index patterns; use _all to perform the operation on all indices

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

forget_follower(*, index, error_trace=None, filter_path=None, follower_cluster=None, follower_index=None, follower_index_uuid=None, human=None, leader_remote_cluster=None, pretty=None, body=None)

Removes the follower retention leases from the leader.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-post-forget-follower.html

Parameters:
  • index (str) – the name of the leader index for which specified follower retention leases should be removed

  • follower_cluster (str | None)

  • follower_index (str | None)

  • follower_index_uuid (str | None)

  • leader_remote_cluster (str | None)

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

  • body (Dict[str, Any] | None)

Return type:

ObjectApiResponse[Any]

get_auto_follow_pattern(*, name=None, error_trace=None, filter_path=None, human=None, pretty=None)

Gets configured auto-follow patterns. Returns the specified auto-follow pattern collection.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-get-auto-follow-pattern.html

Parameters:
  • name (str | None) – Specifies the auto-follow pattern collection that you want to retrieve. If you do not specify a name, the API returns information for all collections.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

pause_auto_follow_pattern(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Pauses an auto-follow pattern

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-pause-auto-follow-pattern.html

Parameters:
  • name (str) – The name of the auto follow pattern that should pause discovering new indices to follow.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

pause_follow(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Pauses a follower index. The follower index will not fetch any additional operations from the leader index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-post-pause-follow.html

Parameters:
  • index (str) – The name of the follower index that should pause following its leader index.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

put_auto_follow_pattern(*, name, remote_cluster=None, error_trace=None, filter_path=None, follow_index_pattern=None, human=None, leader_index_exclusion_patterns=None, leader_index_patterns=None, max_outstanding_read_requests=None, max_outstanding_write_requests=None, max_read_request_operation_count=None, max_read_request_size=None, max_retry_delay=None, max_write_buffer_count=None, max_write_buffer_size=None, max_write_request_operation_count=None, max_write_request_size=None, pretty=None, read_poll_timeout=None, settings=None, body=None)

Creates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-put-auto-follow-pattern.html

Parameters:
  • name (str) – The name of the collection of auto-follow patterns.

  • remote_cluster (str | None) – The remote cluster containing the leader indices to match against.

  • follow_index_pattern (str | None) – The name of follower index. The template {{leader_index}} can be used to derive the name of the follower index from the name of the leader index. When following a data stream, use {{leader_index}}; CCR does not support changes to the names of a follower data stream’s backing indices.

  • leader_index_exclusion_patterns (Sequence[str] | None) – An array of simple index patterns that can be used to exclude indices from being auto-followed. Indices in the remote cluster whose names are matching one or more leader_index_patterns and one or more leader_index_exclusion_patterns won’t be followed.

  • leader_index_patterns (Sequence[str] | None) – An array of simple index patterns to match against indices in the remote cluster specified by the remote_cluster field.

  • max_outstanding_read_requests (int | None) – The maximum number of outstanding reads requests from the remote cluster.

  • max_outstanding_write_requests (int | None) – The maximum number of outstanding reads requests from the remote cluster.

  • max_read_request_operation_count (int | None) – The maximum number of operations to pull per read from the remote cluster.

  • max_read_request_size (int | str | None) – The maximum size in bytes of per read of a batch of operations pulled from the remote cluster.

  • max_retry_delay (str | Literal[-1] | ~typing.Literal[0] | None) – The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when retrying.

  • max_write_buffer_count (int | None) – The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the number of queued operations goes below the limit.

  • max_write_buffer_size (int | str | None) – The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the total bytes of queued operations goes below the limit.

  • max_write_request_operation_count (int | None) – The maximum number of operations per bulk write request executed on the follower.

  • max_write_request_size (int | str | None) – The maximum total bytes of operations per bulk write request executed on the follower.

  • read_poll_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. Then the follower will immediately attempt to read from the leader again.

  • settings (Mapping[str, Any] | None) – Settings to override from the leader index. Note that certain settings can not be overrode (e.g., index.number_of_shards).

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

  • body (Dict[str, Any] | None)

Return type:

ObjectApiResponse[Any]

resume_auto_follow_pattern(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Resumes an auto-follow pattern that has been paused

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-resume-auto-follow-pattern.html

Parameters:
  • name (str) – The name of the auto follow pattern to resume discovering new indices to follow.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

resume_follow(*, index, error_trace=None, filter_path=None, human=None, max_outstanding_read_requests=None, max_outstanding_write_requests=None, max_read_request_operation_count=None, max_read_request_size=None, max_retry_delay=None, max_write_buffer_count=None, max_write_buffer_size=None, max_write_request_operation_count=None, max_write_request_size=None, pretty=None, read_poll_timeout=None, body=None)

Resumes a follower index that has been paused

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-post-resume-follow.html

Parameters:
  • index (str) – The name of the follow index to resume following.

  • max_outstanding_read_requests (int | None)

  • max_outstanding_write_requests (int | None)

  • max_read_request_operation_count (int | None)

  • max_read_request_size (str | None)

  • max_retry_delay (str | Literal[-1] | ~typing.Literal[0] | None)

  • max_write_buffer_count (int | None)

  • max_write_buffer_size (str | None)

  • max_write_request_operation_count (int | None)

  • max_write_request_size (str | None)

  • read_poll_timeout (str | Literal[-1] | ~typing.Literal[0] | None)

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

  • body (Dict[str, Any] | None)

Return type:

ObjectApiResponse[Any]

stats(*, error_trace=None, filter_path=None, human=None, pretty=None)

Gets all stats related to cross-cluster replication.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-get-stats.html

Parameters:
Return type:

ObjectApiResponse[Any]

unfollow(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ccr-post-unfollow.html

Parameters:
  • index (str) – The name of the follower index that should be turned into a regular index.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]