@@ -68,6 +68,8 @@ async def delete_auto_follow_pattern(
6868 @_rewrite_parameters (
6969 body_fields = (
7070 "leader_index" ,
71+ "remote_cluster" ,
72+ "data_stream_name" ,
7173 "max_outstanding_read_requests" ,
7274 "max_outstanding_write_requests" ,
7375 "max_read_request_operation_count" ,
@@ -78,29 +80,31 @@ async def delete_auto_follow_pattern(
7880 "max_write_request_operation_count" ,
7981 "max_write_request_size" ,
8082 "read_poll_timeout" ,
81- "remote_cluster " ,
83+ "settings " ,
8284 ),
8385 )
8486 async def follow (
8587 self ,
8688 * ,
8789 index : str ,
90+ leader_index : t .Optional [str ] = None ,
91+ remote_cluster : t .Optional [str ] = None ,
92+ data_stream_name : t .Optional [str ] = None ,
8893 error_trace : t .Optional [bool ] = None ,
8994 filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
9095 human : t .Optional [bool ] = None ,
91- leader_index : t .Optional [str ] = None ,
9296 max_outstanding_read_requests : t .Optional [int ] = None ,
9397 max_outstanding_write_requests : t .Optional [int ] = None ,
9498 max_read_request_operation_count : t .Optional [int ] = None ,
95- max_read_request_size : t .Optional [str ] = None ,
99+ max_read_request_size : t .Optional [t . Union [ int , str ] ] = None ,
96100 max_retry_delay : t .Optional [t .Union [str , t .Literal [- 1 ], t .Literal [0 ]]] = None ,
97101 max_write_buffer_count : t .Optional [int ] = None ,
98- max_write_buffer_size : t .Optional [str ] = None ,
102+ max_write_buffer_size : t .Optional [t . Union [ int , str ] ] = None ,
99103 max_write_request_operation_count : t .Optional [int ] = None ,
100- max_write_request_size : t .Optional [str ] = None ,
104+ max_write_request_size : t .Optional [t . Union [ int , str ] ] = None ,
101105 pretty : t .Optional [bool ] = None ,
102106 read_poll_timeout : t .Optional [t .Union [str , t .Literal [- 1 ], t .Literal [0 ]]] = None ,
103- remote_cluster : t .Optional [str ] = None ,
107+ settings : t .Optional [t . Mapping [ str , t . Any ] ] = None ,
104108 wait_for_active_shards : t .Optional [
105109 t .Union [int , t .Union [str , t .Literal ["all" , "index-setting" ]]]
106110 ] = None ,
@@ -111,26 +115,51 @@ async def follow(
111115
112116 `<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-put-follow.html>`_
113117
114- :param index: The name of the follower index
115- :param leader_index:
116- :param max_outstanding_read_requests:
117- :param max_outstanding_write_requests:
118- :param max_read_request_operation_count:
119- :param max_read_request_size:
120- :param max_retry_delay:
121- :param max_write_buffer_count:
122- :param max_write_buffer_size:
123- :param max_write_request_operation_count:
124- :param max_write_request_size:
125- :param read_poll_timeout:
126- :param remote_cluster:
127- :param wait_for_active_shards: Sets the number of shard copies that must be active
128- before returning. Defaults to 0. Set to `all` for all shard copies, otherwise
129- set to any non-negative value less than or equal to the total number of copies
130- for the shard (number of replicas + 1)
118+ :param index: The name of the follower index.
119+ :param leader_index: The name of the index in the leader cluster to follow.
120+ :param remote_cluster: The remote cluster containing the leader index.
121+ :param data_stream_name: If the leader index is part of a data stream, the name
122+ to which the local data stream for the followed index should be renamed.
123+ :param max_outstanding_read_requests: The maximum number of outstanding reads
124+ requests from the remote cluster.
125+ :param max_outstanding_write_requests: The maximum number of outstanding write
126+ requests on the follower.
127+ :param max_read_request_operation_count: The maximum number of operations to
128+ pull per read from the remote cluster.
129+ :param max_read_request_size: The maximum size in bytes of per read of a batch
130+ of operations pulled from the remote cluster.
131+ :param max_retry_delay: The maximum time to wait before retrying an operation
132+ that failed exceptionally. An exponential backoff strategy is employed when
133+ retrying.
134+ :param max_write_buffer_count: The maximum number of operations that can be queued
135+ for writing. When this limit is reached, reads from the remote cluster will
136+ be deferred until the number of queued operations goes below the limit.
137+ :param max_write_buffer_size: The maximum total bytes of operations that can
138+ be queued for writing. When this limit is reached, reads from the remote
139+ cluster will be deferred until the total bytes of queued operations goes
140+ below the limit.
141+ :param max_write_request_operation_count: The maximum number of operations per
142+ bulk write request executed on the follower.
143+ :param max_write_request_size: The maximum total bytes of operations per bulk
144+ write request executed on the follower.
145+ :param read_poll_timeout: The maximum time to wait for new operations on the
146+ remote cluster when the follower index is synchronized with the leader index.
147+ When the timeout has elapsed, the poll for operations will return to the
148+ follower so that it can update some statistics. Then the follower will immediately
149+ attempt to read from the leader again.
150+ :param settings: Settings to override from the leader index.
151+ :param wait_for_active_shards: Specifies the number of shards to wait on being
152+ active before responding. This defaults to waiting on none of the shards
153+ to be active. A shard must be restored from the leader index before being
154+ active. Restoring a follower shard requires transferring all the remote Lucene
155+ segment files to the follower index.
131156 """
132157 if index in SKIP_IN_PATH :
133158 raise ValueError ("Empty value passed for parameter 'index'" )
159+ if leader_index is None and body is None :
160+ raise ValueError ("Empty value passed for parameter 'leader_index'" )
161+ if remote_cluster is None and body is None :
162+ raise ValueError ("Empty value passed for parameter 'remote_cluster'" )
134163 __path_parts : t .Dict [str , str ] = {"index" : _quote (index )}
135164 __path = f'/{ __path_parts ["index" ]} /_ccr/follow'
136165 __query : t .Dict [str , t .Any ] = {}
@@ -148,6 +177,10 @@ async def follow(
148177 if not __body :
149178 if leader_index is not None :
150179 __body ["leader_index" ] = leader_index
180+ if remote_cluster is not None :
181+ __body ["remote_cluster" ] = remote_cluster
182+ if data_stream_name is not None :
183+ __body ["data_stream_name" ] = data_stream_name
151184 if max_outstanding_read_requests is not None :
152185 __body ["max_outstanding_read_requests" ] = max_outstanding_read_requests
153186 if max_outstanding_write_requests is not None :
@@ -174,8 +207,8 @@ async def follow(
174207 __body ["max_write_request_size" ] = max_write_request_size
175208 if read_poll_timeout is not None :
176209 __body ["read_poll_timeout" ] = read_poll_timeout
177- if remote_cluster is not None :
178- __body ["remote_cluster " ] = remote_cluster
210+ if settings is not None :
211+ __body ["settings " ] = settings
179212 __headers = {"accept" : "application/json" , "content-type" : "application/json" }
180213 return await self .perform_request ( # type: ignore[return-value]
181214 "PUT" ,
0 commit comments