@@ -68,6 +68,8 @@ async def delete_auto_follow_pattern(
68
68
@_rewrite_parameters (
69
69
body_fields = (
70
70
"leader_index" ,
71
+ "remote_cluster" ,
72
+ "data_stream_name" ,
71
73
"max_outstanding_read_requests" ,
72
74
"max_outstanding_write_requests" ,
73
75
"max_read_request_operation_count" ,
@@ -78,29 +80,31 @@ async def delete_auto_follow_pattern(
78
80
"max_write_request_operation_count" ,
79
81
"max_write_request_size" ,
80
82
"read_poll_timeout" ,
81
- "remote_cluster " ,
83
+ "settings " ,
82
84
),
83
85
)
84
86
async def follow (
85
87
self ,
86
88
* ,
87
89
index : str ,
90
+ leader_index : t .Optional [str ] = None ,
91
+ remote_cluster : t .Optional [str ] = None ,
92
+ data_stream_name : t .Optional [str ] = None ,
88
93
error_trace : t .Optional [bool ] = None ,
89
94
filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
90
95
human : t .Optional [bool ] = None ,
91
- leader_index : t .Optional [str ] = None ,
92
96
max_outstanding_read_requests : t .Optional [int ] = None ,
93
97
max_outstanding_write_requests : t .Optional [int ] = None ,
94
98
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 ,
96
100
max_retry_delay : t .Optional [t .Union [str , t .Literal [- 1 ], t .Literal [0 ]]] = None ,
97
101
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 ,
99
103
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 ,
101
105
pretty : t .Optional [bool ] = None ,
102
106
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 ,
104
108
wait_for_active_shards : t .Optional [
105
109
t .Union [int , t .Union [str , t .Literal ["all" , "index-setting" ]]]
106
110
] = None ,
@@ -111,26 +115,51 @@ async def follow(
111
115
112
116
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-put-follow.html>`_
113
117
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.
131
156
"""
132
157
if index in SKIP_IN_PATH :
133
158
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'" )
134
163
__path_parts : t .Dict [str , str ] = {"index" : _quote (index )}
135
164
__path = f'/{ __path_parts ["index" ]} /_ccr/follow'
136
165
__query : t .Dict [str , t .Any ] = {}
@@ -148,6 +177,10 @@ async def follow(
148
177
if not __body :
149
178
if leader_index is not None :
150
179
__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
151
184
if max_outstanding_read_requests is not None :
152
185
__body ["max_outstanding_read_requests" ] = max_outstanding_read_requests
153
186
if max_outstanding_write_requests is not None :
@@ -174,8 +207,8 @@ async def follow(
174
207
__body ["max_write_request_size" ] = max_write_request_size
175
208
if read_poll_timeout is not None :
176
209
__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
179
212
__headers = {"accept" : "application/json" , "content-type" : "application/json" }
180
213
return await self .perform_request ( # type: ignore[return-value]
181
214
"PUT" ,
0 commit comments