elasticsearch9 9.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. elasticsearch9/__init__.py +98 -0
  2. elasticsearch9/_async/__init__.py +16 -0
  3. elasticsearch9/_async/client/__init__.py +6531 -0
  4. elasticsearch9/_async/client/_base.py +430 -0
  5. elasticsearch9/_async/client/async_search.py +637 -0
  6. elasticsearch9/_async/client/autoscaling.py +252 -0
  7. elasticsearch9/_async/client/cat.py +2995 -0
  8. elasticsearch9/_async/client/ccr.py +1043 -0
  9. elasticsearch9/_async/client/cluster.py +1223 -0
  10. elasticsearch9/_async/client/connector.py +1978 -0
  11. elasticsearch9/_async/client/dangling_indices.py +192 -0
  12. elasticsearch9/_async/client/enrich.py +291 -0
  13. elasticsearch9/_async/client/eql.py +359 -0
  14. elasticsearch9/_async/client/esql.py +490 -0
  15. elasticsearch9/_async/client/features.py +130 -0
  16. elasticsearch9/_async/client/fleet.py +658 -0
  17. elasticsearch9/_async/client/graph.py +113 -0
  18. elasticsearch9/_async/client/ilm.py +668 -0
  19. elasticsearch9/_async/client/indices.py +5582 -0
  20. elasticsearch9/_async/client/inference.py +2247 -0
  21. elasticsearch9/_async/client/ingest.py +766 -0
  22. elasticsearch9/_async/client/license.py +400 -0
  23. elasticsearch9/_async/client/logstash.py +176 -0
  24. elasticsearch9/_async/client/migration.py +160 -0
  25. elasticsearch9/_async/client/ml.py +5835 -0
  26. elasticsearch9/_async/client/monitoring.py +100 -0
  27. elasticsearch9/_async/client/nodes.py +543 -0
  28. elasticsearch9/_async/client/query_rules.py +485 -0
  29. elasticsearch9/_async/client/rollup.py +616 -0
  30. elasticsearch9/_async/client/search_application.py +574 -0
  31. elasticsearch9/_async/client/searchable_snapshots.py +313 -0
  32. elasticsearch9/_async/client/security.py +4688 -0
  33. elasticsearch9/_async/client/shutdown.py +268 -0
  34. elasticsearch9/_async/client/simulate.py +145 -0
  35. elasticsearch9/_async/client/slm.py +559 -0
  36. elasticsearch9/_async/client/snapshot.py +1338 -0
  37. elasticsearch9/_async/client/sql.py +469 -0
  38. elasticsearch9/_async/client/ssl.py +76 -0
  39. elasticsearch9/_async/client/synonyms.py +413 -0
  40. elasticsearch9/_async/client/tasks.py +295 -0
  41. elasticsearch9/_async/client/text_structure.py +664 -0
  42. elasticsearch9/_async/client/transform.py +922 -0
  43. elasticsearch9/_async/client/utils.py +48 -0
  44. elasticsearch9/_async/client/watcher.py +894 -0
  45. elasticsearch9/_async/client/xpack.py +134 -0
  46. elasticsearch9/_async/helpers.py +596 -0
  47. elasticsearch9/_otel.py +110 -0
  48. elasticsearch9/_sync/__init__.py +16 -0
  49. elasticsearch9/_sync/client/__init__.py +6529 -0
  50. elasticsearch9/_sync/client/_base.py +430 -0
  51. elasticsearch9/_sync/client/async_search.py +637 -0
  52. elasticsearch9/_sync/client/autoscaling.py +252 -0
  53. elasticsearch9/_sync/client/cat.py +2995 -0
  54. elasticsearch9/_sync/client/ccr.py +1043 -0
  55. elasticsearch9/_sync/client/cluster.py +1223 -0
  56. elasticsearch9/_sync/client/connector.py +1978 -0
  57. elasticsearch9/_sync/client/dangling_indices.py +192 -0
  58. elasticsearch9/_sync/client/enrich.py +291 -0
  59. elasticsearch9/_sync/client/eql.py +359 -0
  60. elasticsearch9/_sync/client/esql.py +490 -0
  61. elasticsearch9/_sync/client/features.py +130 -0
  62. elasticsearch9/_sync/client/fleet.py +658 -0
  63. elasticsearch9/_sync/client/graph.py +113 -0
  64. elasticsearch9/_sync/client/ilm.py +668 -0
  65. elasticsearch9/_sync/client/indices.py +5582 -0
  66. elasticsearch9/_sync/client/inference.py +2247 -0
  67. elasticsearch9/_sync/client/ingest.py +766 -0
  68. elasticsearch9/_sync/client/license.py +400 -0
  69. elasticsearch9/_sync/client/logstash.py +176 -0
  70. elasticsearch9/_sync/client/migration.py +160 -0
  71. elasticsearch9/_sync/client/ml.py +5835 -0
  72. elasticsearch9/_sync/client/monitoring.py +100 -0
  73. elasticsearch9/_sync/client/nodes.py +543 -0
  74. elasticsearch9/_sync/client/query_rules.py +485 -0
  75. elasticsearch9/_sync/client/rollup.py +616 -0
  76. elasticsearch9/_sync/client/search_application.py +574 -0
  77. elasticsearch9/_sync/client/searchable_snapshots.py +313 -0
  78. elasticsearch9/_sync/client/security.py +4688 -0
  79. elasticsearch9/_sync/client/shutdown.py +268 -0
  80. elasticsearch9/_sync/client/simulate.py +145 -0
  81. elasticsearch9/_sync/client/slm.py +559 -0
  82. elasticsearch9/_sync/client/snapshot.py +1338 -0
  83. elasticsearch9/_sync/client/sql.py +469 -0
  84. elasticsearch9/_sync/client/ssl.py +76 -0
  85. elasticsearch9/_sync/client/synonyms.py +413 -0
  86. elasticsearch9/_sync/client/tasks.py +295 -0
  87. elasticsearch9/_sync/client/text_structure.py +664 -0
  88. elasticsearch9/_sync/client/transform.py +922 -0
  89. elasticsearch9/_sync/client/utils.py +475 -0
  90. elasticsearch9/_sync/client/watcher.py +894 -0
  91. elasticsearch9/_sync/client/xpack.py +134 -0
  92. elasticsearch9/_utils.py +34 -0
  93. elasticsearch9/_version.py +18 -0
  94. elasticsearch9/client.py +126 -0
  95. elasticsearch9/compat.py +79 -0
  96. elasticsearch9/dsl/__init__.py +203 -0
  97. elasticsearch9/dsl/_async/__init__.py +16 -0
  98. elasticsearch9/dsl/_async/document.py +522 -0
  99. elasticsearch9/dsl/_async/faceted_search.py +50 -0
  100. elasticsearch9/dsl/_async/index.py +639 -0
  101. elasticsearch9/dsl/_async/mapping.py +49 -0
  102. elasticsearch9/dsl/_async/search.py +237 -0
  103. elasticsearch9/dsl/_async/update_by_query.py +47 -0
  104. elasticsearch9/dsl/_sync/__init__.py +16 -0
  105. elasticsearch9/dsl/_sync/document.py +514 -0
  106. elasticsearch9/dsl/_sync/faceted_search.py +50 -0
  107. elasticsearch9/dsl/_sync/index.py +597 -0
  108. elasticsearch9/dsl/_sync/mapping.py +49 -0
  109. elasticsearch9/dsl/_sync/search.py +230 -0
  110. elasticsearch9/dsl/_sync/update_by_query.py +45 -0
  111. elasticsearch9/dsl/aggs.py +3734 -0
  112. elasticsearch9/dsl/analysis.py +341 -0
  113. elasticsearch9/dsl/async_connections.py +37 -0
  114. elasticsearch9/dsl/connections.py +142 -0
  115. elasticsearch9/dsl/document.py +20 -0
  116. elasticsearch9/dsl/document_base.py +444 -0
  117. elasticsearch9/dsl/exceptions.py +32 -0
  118. elasticsearch9/dsl/faceted_search.py +28 -0
  119. elasticsearch9/dsl/faceted_search_base.py +489 -0
  120. elasticsearch9/dsl/field.py +4392 -0
  121. elasticsearch9/dsl/function.py +180 -0
  122. elasticsearch9/dsl/index.py +23 -0
  123. elasticsearch9/dsl/index_base.py +178 -0
  124. elasticsearch9/dsl/mapping.py +19 -0
  125. elasticsearch9/dsl/mapping_base.py +219 -0
  126. elasticsearch9/dsl/query.py +2822 -0
  127. elasticsearch9/dsl/response/__init__.py +388 -0
  128. elasticsearch9/dsl/response/aggs.py +100 -0
  129. elasticsearch9/dsl/response/hit.py +53 -0
  130. elasticsearch9/dsl/search.py +20 -0
  131. elasticsearch9/dsl/search_base.py +1053 -0
  132. elasticsearch9/dsl/serializer.py +34 -0
  133. elasticsearch9/dsl/types.py +6453 -0
  134. elasticsearch9/dsl/update_by_query.py +19 -0
  135. elasticsearch9/dsl/update_by_query_base.py +149 -0
  136. elasticsearch9/dsl/utils.py +687 -0
  137. elasticsearch9/dsl/wrappers.py +144 -0
  138. elasticsearch9/exceptions.py +133 -0
  139. elasticsearch9/helpers/__init__.py +41 -0
  140. elasticsearch9/helpers/actions.py +875 -0
  141. elasticsearch9/helpers/errors.py +40 -0
  142. elasticsearch9/helpers/vectorstore/__init__.py +62 -0
  143. elasticsearch9/helpers/vectorstore/_async/__init__.py +16 -0
  144. elasticsearch9/helpers/vectorstore/_async/_utils.py +39 -0
  145. elasticsearch9/helpers/vectorstore/_async/embedding_service.py +89 -0
  146. elasticsearch9/helpers/vectorstore/_async/strategies.py +487 -0
  147. elasticsearch9/helpers/vectorstore/_async/vectorstore.py +421 -0
  148. elasticsearch9/helpers/vectorstore/_sync/__init__.py +16 -0
  149. elasticsearch9/helpers/vectorstore/_sync/_utils.py +39 -0
  150. elasticsearch9/helpers/vectorstore/_sync/embedding_service.py +89 -0
  151. elasticsearch9/helpers/vectorstore/_sync/strategies.py +487 -0
  152. elasticsearch9/helpers/vectorstore/_sync/vectorstore.py +421 -0
  153. elasticsearch9/helpers/vectorstore/_utils.py +116 -0
  154. elasticsearch9/py.typed +0 -0
  155. elasticsearch9/serializer.py +250 -0
  156. elasticsearch9-9.0.0.dist-info/METADATA +175 -0
  157. elasticsearch9-9.0.0.dist-info/RECORD +160 -0
  158. elasticsearch9-9.0.0.dist-info/WHEEL +4 -0
  159. elasticsearch9-9.0.0.dist-info/licenses/LICENSE +176 -0
  160. elasticsearch9-9.0.0.dist-info/licenses/NOTICE +2 -0
@@ -0,0 +1,1043 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ import typing as t
19
+
20
+ from elastic_transport import ObjectApiResponse
21
+
22
+ from ._base import NamespacedClient
23
+ from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
24
+
25
+
26
+ class CcrClient(NamespacedClient):
27
+
28
+ @_rewrite_parameters()
29
+ def delete_auto_follow_pattern(
30
+ self,
31
+ *,
32
+ name: str,
33
+ error_trace: t.Optional[bool] = None,
34
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
35
+ human: t.Optional[bool] = None,
36
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
37
+ pretty: t.Optional[bool] = None,
38
+ ) -> ObjectApiResponse[t.Any]:
39
+ """
40
+ .. raw:: html
41
+
42
+ <p>Delete auto-follow patterns.</p>
43
+ <p>Delete a collection of cross-cluster replication auto-follow patterns.</p>
44
+
45
+
46
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-delete-auto-follow-pattern>`_
47
+
48
+ :param name: The auto-follow pattern collection to delete.
49
+ :param master_timeout: The period to wait for a connection to the master node.
50
+ If the master node is not available before the timeout expires, the request
51
+ fails and returns an error. It can also be set to `-1` to indicate that the
52
+ request should never timeout.
53
+ """
54
+ if name in SKIP_IN_PATH:
55
+ raise ValueError("Empty value passed for parameter 'name'")
56
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
57
+ __path = f'/_ccr/auto_follow/{__path_parts["name"]}'
58
+ __query: t.Dict[str, t.Any] = {}
59
+ if error_trace is not None:
60
+ __query["error_trace"] = error_trace
61
+ if filter_path is not None:
62
+ __query["filter_path"] = filter_path
63
+ if human is not None:
64
+ __query["human"] = human
65
+ if master_timeout is not None:
66
+ __query["master_timeout"] = master_timeout
67
+ if pretty is not None:
68
+ __query["pretty"] = pretty
69
+ __headers = {"accept": "application/json"}
70
+ return self.perform_request( # type: ignore[return-value]
71
+ "DELETE",
72
+ __path,
73
+ params=__query,
74
+ headers=__headers,
75
+ endpoint_id="ccr.delete_auto_follow_pattern",
76
+ path_parts=__path_parts,
77
+ )
78
+
79
+ @_rewrite_parameters(
80
+ body_fields=(
81
+ "leader_index",
82
+ "remote_cluster",
83
+ "data_stream_name",
84
+ "max_outstanding_read_requests",
85
+ "max_outstanding_write_requests",
86
+ "max_read_request_operation_count",
87
+ "max_read_request_size",
88
+ "max_retry_delay",
89
+ "max_write_buffer_count",
90
+ "max_write_buffer_size",
91
+ "max_write_request_operation_count",
92
+ "max_write_request_size",
93
+ "read_poll_timeout",
94
+ "settings",
95
+ ),
96
+ )
97
+ def follow(
98
+ self,
99
+ *,
100
+ index: str,
101
+ leader_index: t.Optional[str] = None,
102
+ remote_cluster: t.Optional[str] = None,
103
+ data_stream_name: t.Optional[str] = None,
104
+ error_trace: t.Optional[bool] = None,
105
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
106
+ human: t.Optional[bool] = None,
107
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
108
+ max_outstanding_read_requests: t.Optional[int] = None,
109
+ max_outstanding_write_requests: t.Optional[int] = None,
110
+ max_read_request_operation_count: t.Optional[int] = None,
111
+ max_read_request_size: t.Optional[t.Union[int, str]] = None,
112
+ max_retry_delay: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
113
+ max_write_buffer_count: t.Optional[int] = None,
114
+ max_write_buffer_size: t.Optional[t.Union[int, str]] = None,
115
+ max_write_request_operation_count: t.Optional[int] = None,
116
+ max_write_request_size: t.Optional[t.Union[int, str]] = None,
117
+ pretty: t.Optional[bool] = None,
118
+ read_poll_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
119
+ settings: t.Optional[t.Mapping[str, t.Any]] = None,
120
+ wait_for_active_shards: t.Optional[
121
+ t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
122
+ ] = None,
123
+ body: t.Optional[t.Dict[str, t.Any]] = None,
124
+ ) -> ObjectApiResponse[t.Any]:
125
+ """
126
+ .. raw:: html
127
+
128
+ <p>Create a follower.
129
+ Create a cross-cluster replication follower index that follows a specific leader index.
130
+ When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index.</p>
131
+
132
+
133
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-follow>`_
134
+
135
+ :param index: The name of the follower index.
136
+ :param leader_index: The name of the index in the leader cluster to follow.
137
+ :param remote_cluster: The remote cluster containing the leader index.
138
+ :param data_stream_name: If the leader index is part of a data stream, the name
139
+ to which the local data stream for the followed index should be renamed.
140
+ :param master_timeout: Period to wait for a connection to the master node.
141
+ :param max_outstanding_read_requests: The maximum number of outstanding reads
142
+ requests from the remote cluster.
143
+ :param max_outstanding_write_requests: The maximum number of outstanding write
144
+ requests on the follower.
145
+ :param max_read_request_operation_count: The maximum number of operations to
146
+ pull per read from the remote cluster.
147
+ :param max_read_request_size: The maximum size in bytes of per read of a batch
148
+ of operations pulled from the remote cluster.
149
+ :param max_retry_delay: The maximum time to wait before retrying an operation
150
+ that failed exceptionally. An exponential backoff strategy is employed when
151
+ retrying.
152
+ :param max_write_buffer_count: The maximum number of operations that can be queued
153
+ for writing. When this limit is reached, reads from the remote cluster will
154
+ be deferred until the number of queued operations goes below the limit.
155
+ :param max_write_buffer_size: The maximum total bytes of operations that can
156
+ be queued for writing. When this limit is reached, reads from the remote
157
+ cluster will be deferred until the total bytes of queued operations goes
158
+ below the limit.
159
+ :param max_write_request_operation_count: The maximum number of operations per
160
+ bulk write request executed on the follower.
161
+ :param max_write_request_size: The maximum total bytes of operations per bulk
162
+ write request executed on the follower.
163
+ :param read_poll_timeout: The maximum time to wait for new operations on the
164
+ remote cluster when the follower index is synchronized with the leader index.
165
+ When the timeout has elapsed, the poll for operations will return to the
166
+ follower so that it can update some statistics. Then the follower will immediately
167
+ attempt to read from the leader again.
168
+ :param settings: Settings to override from the leader index.
169
+ :param wait_for_active_shards: Specifies the number of shards to wait on being
170
+ active before responding. This defaults to waiting on none of the shards
171
+ to be active. A shard must be restored from the leader index before being
172
+ active. Restoring a follower shard requires transferring all the remote Lucene
173
+ segment files to the follower index.
174
+ """
175
+ if index in SKIP_IN_PATH:
176
+ raise ValueError("Empty value passed for parameter 'index'")
177
+ if leader_index is None and body is None:
178
+ raise ValueError("Empty value passed for parameter 'leader_index'")
179
+ if remote_cluster is None and body is None:
180
+ raise ValueError("Empty value passed for parameter 'remote_cluster'")
181
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
182
+ __path = f'/{__path_parts["index"]}/_ccr/follow'
183
+ __query: t.Dict[str, t.Any] = {}
184
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
185
+ if error_trace is not None:
186
+ __query["error_trace"] = error_trace
187
+ if filter_path is not None:
188
+ __query["filter_path"] = filter_path
189
+ if human is not None:
190
+ __query["human"] = human
191
+ if master_timeout is not None:
192
+ __query["master_timeout"] = master_timeout
193
+ if pretty is not None:
194
+ __query["pretty"] = pretty
195
+ if wait_for_active_shards is not None:
196
+ __query["wait_for_active_shards"] = wait_for_active_shards
197
+ if not __body:
198
+ if leader_index is not None:
199
+ __body["leader_index"] = leader_index
200
+ if remote_cluster is not None:
201
+ __body["remote_cluster"] = remote_cluster
202
+ if data_stream_name is not None:
203
+ __body["data_stream_name"] = data_stream_name
204
+ if max_outstanding_read_requests is not None:
205
+ __body["max_outstanding_read_requests"] = max_outstanding_read_requests
206
+ if max_outstanding_write_requests is not None:
207
+ __body["max_outstanding_write_requests"] = (
208
+ max_outstanding_write_requests
209
+ )
210
+ if max_read_request_operation_count is not None:
211
+ __body["max_read_request_operation_count"] = (
212
+ max_read_request_operation_count
213
+ )
214
+ if max_read_request_size is not None:
215
+ __body["max_read_request_size"] = max_read_request_size
216
+ if max_retry_delay is not None:
217
+ __body["max_retry_delay"] = max_retry_delay
218
+ if max_write_buffer_count is not None:
219
+ __body["max_write_buffer_count"] = max_write_buffer_count
220
+ if max_write_buffer_size is not None:
221
+ __body["max_write_buffer_size"] = max_write_buffer_size
222
+ if max_write_request_operation_count is not None:
223
+ __body["max_write_request_operation_count"] = (
224
+ max_write_request_operation_count
225
+ )
226
+ if max_write_request_size is not None:
227
+ __body["max_write_request_size"] = max_write_request_size
228
+ if read_poll_timeout is not None:
229
+ __body["read_poll_timeout"] = read_poll_timeout
230
+ if settings is not None:
231
+ __body["settings"] = settings
232
+ __headers = {"accept": "application/json", "content-type": "application/json"}
233
+ return self.perform_request( # type: ignore[return-value]
234
+ "PUT",
235
+ __path,
236
+ params=__query,
237
+ headers=__headers,
238
+ body=__body,
239
+ endpoint_id="ccr.follow",
240
+ path_parts=__path_parts,
241
+ )
242
+
243
+ @_rewrite_parameters()
244
+ def follow_info(
245
+ self,
246
+ *,
247
+ index: t.Union[str, t.Sequence[str]],
248
+ error_trace: t.Optional[bool] = None,
249
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
250
+ human: t.Optional[bool] = None,
251
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
252
+ pretty: t.Optional[bool] = None,
253
+ ) -> ObjectApiResponse[t.Any]:
254
+ """
255
+ .. raw:: html
256
+
257
+ <p>Get follower information.</p>
258
+ <p>Get information about all cross-cluster replication follower indices.
259
+ For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused.</p>
260
+
261
+
262
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-follow-info>`_
263
+
264
+ :param index: A comma-delimited list of follower index patterns.
265
+ :param master_timeout: The period to wait for a connection to the master node.
266
+ If the master node is not available before the timeout expires, the request
267
+ fails and returns an error. It can also be set to `-1` to indicate that the
268
+ request should never timeout.
269
+ """
270
+ if index in SKIP_IN_PATH:
271
+ raise ValueError("Empty value passed for parameter 'index'")
272
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
273
+ __path = f'/{__path_parts["index"]}/_ccr/info'
274
+ __query: t.Dict[str, t.Any] = {}
275
+ if error_trace is not None:
276
+ __query["error_trace"] = error_trace
277
+ if filter_path is not None:
278
+ __query["filter_path"] = filter_path
279
+ if human is not None:
280
+ __query["human"] = human
281
+ if master_timeout is not None:
282
+ __query["master_timeout"] = master_timeout
283
+ if pretty is not None:
284
+ __query["pretty"] = pretty
285
+ __headers = {"accept": "application/json"}
286
+ return self.perform_request( # type: ignore[return-value]
287
+ "GET",
288
+ __path,
289
+ params=__query,
290
+ headers=__headers,
291
+ endpoint_id="ccr.follow_info",
292
+ path_parts=__path_parts,
293
+ )
294
+
295
+ @_rewrite_parameters()
296
+ def follow_stats(
297
+ self,
298
+ *,
299
+ index: t.Union[str, t.Sequence[str]],
300
+ error_trace: t.Optional[bool] = None,
301
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
302
+ human: t.Optional[bool] = None,
303
+ pretty: t.Optional[bool] = None,
304
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
305
+ ) -> ObjectApiResponse[t.Any]:
306
+ """
307
+ .. raw:: html
308
+
309
+ <p>Get follower stats.</p>
310
+ <p>Get cross-cluster replication follower stats.
311
+ The API returns shard-level stats about the &quot;following tasks&quot; associated with each shard for the specified indices.</p>
312
+
313
+
314
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-follow-stats>`_
315
+
316
+ :param index: A comma-delimited list of index patterns.
317
+ :param timeout: The period to wait for a response. If no response is received
318
+ before the timeout expires, the request fails and returns an error.
319
+ """
320
+ if index in SKIP_IN_PATH:
321
+ raise ValueError("Empty value passed for parameter 'index'")
322
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
323
+ __path = f'/{__path_parts["index"]}/_ccr/stats'
324
+ __query: t.Dict[str, t.Any] = {}
325
+ if error_trace is not None:
326
+ __query["error_trace"] = error_trace
327
+ if filter_path is not None:
328
+ __query["filter_path"] = filter_path
329
+ if human is not None:
330
+ __query["human"] = human
331
+ if pretty is not None:
332
+ __query["pretty"] = pretty
333
+ if timeout is not None:
334
+ __query["timeout"] = timeout
335
+ __headers = {"accept": "application/json"}
336
+ return self.perform_request( # type: ignore[return-value]
337
+ "GET",
338
+ __path,
339
+ params=__query,
340
+ headers=__headers,
341
+ endpoint_id="ccr.follow_stats",
342
+ path_parts=__path_parts,
343
+ )
344
+
345
+ @_rewrite_parameters(
346
+ body_fields=(
347
+ "follower_cluster",
348
+ "follower_index",
349
+ "follower_index_uuid",
350
+ "leader_remote_cluster",
351
+ ),
352
+ )
353
+ def forget_follower(
354
+ self,
355
+ *,
356
+ index: str,
357
+ error_trace: t.Optional[bool] = None,
358
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
359
+ follower_cluster: t.Optional[str] = None,
360
+ follower_index: t.Optional[str] = None,
361
+ follower_index_uuid: t.Optional[str] = None,
362
+ human: t.Optional[bool] = None,
363
+ leader_remote_cluster: t.Optional[str] = None,
364
+ pretty: t.Optional[bool] = None,
365
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
366
+ body: t.Optional[t.Dict[str, t.Any]] = None,
367
+ ) -> ObjectApiResponse[t.Any]:
368
+ """
369
+ .. raw:: html
370
+
371
+ <p>Forget a follower.
372
+ Remove the cross-cluster replication follower retention leases from the leader.</p>
373
+ <p>A following index takes out retention leases on its leader index.
374
+ These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication.
375
+ When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed.
376
+ However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable.
377
+ While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index.
378
+ This API exists to enable manually removing the leases when the unfollow API is unable to do so.</p>
379
+ <p>NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader.
380
+ The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked.</p>
381
+
382
+
383
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-forget-follower>`_
384
+
385
+ :param index: the name of the leader index for which specified follower retention
386
+ leases should be removed
387
+ :param follower_cluster:
388
+ :param follower_index:
389
+ :param follower_index_uuid:
390
+ :param leader_remote_cluster:
391
+ :param timeout: Period to wait for a response. If no response is received before
392
+ the timeout expires, the request fails and returns an error.
393
+ """
394
+ if index in SKIP_IN_PATH:
395
+ raise ValueError("Empty value passed for parameter 'index'")
396
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
397
+ __path = f'/{__path_parts["index"]}/_ccr/forget_follower'
398
+ __query: t.Dict[str, t.Any] = {}
399
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
400
+ if error_trace is not None:
401
+ __query["error_trace"] = error_trace
402
+ if filter_path is not None:
403
+ __query["filter_path"] = filter_path
404
+ if human is not None:
405
+ __query["human"] = human
406
+ if pretty is not None:
407
+ __query["pretty"] = pretty
408
+ if timeout is not None:
409
+ __query["timeout"] = timeout
410
+ if not __body:
411
+ if follower_cluster is not None:
412
+ __body["follower_cluster"] = follower_cluster
413
+ if follower_index is not None:
414
+ __body["follower_index"] = follower_index
415
+ if follower_index_uuid is not None:
416
+ __body["follower_index_uuid"] = follower_index_uuid
417
+ if leader_remote_cluster is not None:
418
+ __body["leader_remote_cluster"] = leader_remote_cluster
419
+ __headers = {"accept": "application/json", "content-type": "application/json"}
420
+ return self.perform_request( # type: ignore[return-value]
421
+ "POST",
422
+ __path,
423
+ params=__query,
424
+ headers=__headers,
425
+ body=__body,
426
+ endpoint_id="ccr.forget_follower",
427
+ path_parts=__path_parts,
428
+ )
429
+
430
+ @_rewrite_parameters()
431
+ def get_auto_follow_pattern(
432
+ self,
433
+ *,
434
+ name: t.Optional[str] = None,
435
+ error_trace: t.Optional[bool] = None,
436
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
437
+ human: t.Optional[bool] = None,
438
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
439
+ pretty: t.Optional[bool] = None,
440
+ ) -> ObjectApiResponse[t.Any]:
441
+ """
442
+ .. raw:: html
443
+
444
+ <p>Get auto-follow patterns.</p>
445
+ <p>Get cross-cluster replication auto-follow patterns.</p>
446
+
447
+
448
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-get-auto-follow-pattern-1>`_
449
+
450
+ :param name: The auto-follow pattern collection that you want to retrieve. If
451
+ you do not specify a name, the API returns information for all collections.
452
+ :param master_timeout: The period to wait for a connection to the master node.
453
+ If the master node is not available before the timeout expires, the request
454
+ fails and returns an error. It can also be set to `-1` to indicate that the
455
+ request should never timeout.
456
+ """
457
+ __path_parts: t.Dict[str, str]
458
+ if name not in SKIP_IN_PATH:
459
+ __path_parts = {"name": _quote(name)}
460
+ __path = f'/_ccr/auto_follow/{__path_parts["name"]}'
461
+ else:
462
+ __path_parts = {}
463
+ __path = "/_ccr/auto_follow"
464
+ __query: t.Dict[str, t.Any] = {}
465
+ if error_trace is not None:
466
+ __query["error_trace"] = error_trace
467
+ if filter_path is not None:
468
+ __query["filter_path"] = filter_path
469
+ if human is not None:
470
+ __query["human"] = human
471
+ if master_timeout is not None:
472
+ __query["master_timeout"] = master_timeout
473
+ if pretty is not None:
474
+ __query["pretty"] = pretty
475
+ __headers = {"accept": "application/json"}
476
+ return self.perform_request( # type: ignore[return-value]
477
+ "GET",
478
+ __path,
479
+ params=__query,
480
+ headers=__headers,
481
+ endpoint_id="ccr.get_auto_follow_pattern",
482
+ path_parts=__path_parts,
483
+ )
484
+
485
+ @_rewrite_parameters()
486
+ def pause_auto_follow_pattern(
487
+ self,
488
+ *,
489
+ name: str,
490
+ error_trace: t.Optional[bool] = None,
491
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
492
+ human: t.Optional[bool] = None,
493
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
494
+ pretty: t.Optional[bool] = None,
495
+ ) -> ObjectApiResponse[t.Any]:
496
+ """
497
+ .. raw:: html
498
+
499
+ <p>Pause an auto-follow pattern.</p>
500
+ <p>Pause a cross-cluster replication auto-follow pattern.
501
+ When the API returns, the auto-follow pattern is inactive.
502
+ New indices that are created on the remote cluster and match the auto-follow patterns are ignored.</p>
503
+ <p>You can resume auto-following with the resume auto-follow pattern API.
504
+ When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns.
505
+ Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim.</p>
506
+
507
+
508
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-pause-auto-follow-pattern>`_
509
+
510
+ :param name: The name of the auto-follow pattern to pause.
511
+ :param master_timeout: The period to wait for a connection to the master node.
512
+ If the master node is not available before the timeout expires, the request
513
+ fails and returns an error. It can also be set to `-1` to indicate that the
514
+ request should never timeout.
515
+ """
516
+ if name in SKIP_IN_PATH:
517
+ raise ValueError("Empty value passed for parameter 'name'")
518
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
519
+ __path = f'/_ccr/auto_follow/{__path_parts["name"]}/pause'
520
+ __query: t.Dict[str, t.Any] = {}
521
+ if error_trace is not None:
522
+ __query["error_trace"] = error_trace
523
+ if filter_path is not None:
524
+ __query["filter_path"] = filter_path
525
+ if human is not None:
526
+ __query["human"] = human
527
+ if master_timeout is not None:
528
+ __query["master_timeout"] = master_timeout
529
+ if pretty is not None:
530
+ __query["pretty"] = pretty
531
+ __headers = {"accept": "application/json"}
532
+ return self.perform_request( # type: ignore[return-value]
533
+ "POST",
534
+ __path,
535
+ params=__query,
536
+ headers=__headers,
537
+ endpoint_id="ccr.pause_auto_follow_pattern",
538
+ path_parts=__path_parts,
539
+ )
540
+
541
+ @_rewrite_parameters()
542
+ def pause_follow(
543
+ self,
544
+ *,
545
+ index: str,
546
+ error_trace: t.Optional[bool] = None,
547
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
548
+ human: t.Optional[bool] = None,
549
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
550
+ pretty: t.Optional[bool] = None,
551
+ ) -> ObjectApiResponse[t.Any]:
552
+ """
553
+ .. raw:: html
554
+
555
+ <p>Pause a follower.</p>
556
+ <p>Pause a cross-cluster replication follower index.
557
+ The follower index will not fetch any additional operations from the leader index.
558
+ You can resume following with the resume follower API.
559
+ You can pause and resume a follower index to change the configuration of the following task.</p>
560
+
561
+
562
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-pause-follow>`_
563
+
564
+ :param index: The name of the follower index.
565
+ :param master_timeout: The period to wait for a connection to the master node.
566
+ If the master node is not available before the timeout expires, the request
567
+ fails and returns an error. It can also be set to `-1` to indicate that the
568
+ request should never timeout.
569
+ """
570
+ if index in SKIP_IN_PATH:
571
+ raise ValueError("Empty value passed for parameter 'index'")
572
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
573
+ __path = f'/{__path_parts["index"]}/_ccr/pause_follow'
574
+ __query: t.Dict[str, t.Any] = {}
575
+ if error_trace is not None:
576
+ __query["error_trace"] = error_trace
577
+ if filter_path is not None:
578
+ __query["filter_path"] = filter_path
579
+ if human is not None:
580
+ __query["human"] = human
581
+ if master_timeout is not None:
582
+ __query["master_timeout"] = master_timeout
583
+ if pretty is not None:
584
+ __query["pretty"] = pretty
585
+ __headers = {"accept": "application/json"}
586
+ return self.perform_request( # type: ignore[return-value]
587
+ "POST",
588
+ __path,
589
+ params=__query,
590
+ headers=__headers,
591
+ endpoint_id="ccr.pause_follow",
592
+ path_parts=__path_parts,
593
+ )
594
+
595
+ @_rewrite_parameters(
596
+ body_fields=(
597
+ "remote_cluster",
598
+ "follow_index_pattern",
599
+ "leader_index_exclusion_patterns",
600
+ "leader_index_patterns",
601
+ "max_outstanding_read_requests",
602
+ "max_outstanding_write_requests",
603
+ "max_read_request_operation_count",
604
+ "max_read_request_size",
605
+ "max_retry_delay",
606
+ "max_write_buffer_count",
607
+ "max_write_buffer_size",
608
+ "max_write_request_operation_count",
609
+ "max_write_request_size",
610
+ "read_poll_timeout",
611
+ "settings",
612
+ ),
613
+ )
614
+ def put_auto_follow_pattern(
615
+ self,
616
+ *,
617
+ name: str,
618
+ remote_cluster: t.Optional[str] = None,
619
+ error_trace: t.Optional[bool] = None,
620
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
621
+ follow_index_pattern: t.Optional[str] = None,
622
+ human: t.Optional[bool] = None,
623
+ leader_index_exclusion_patterns: t.Optional[t.Sequence[str]] = None,
624
+ leader_index_patterns: t.Optional[t.Sequence[str]] = None,
625
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
626
+ max_outstanding_read_requests: t.Optional[int] = None,
627
+ max_outstanding_write_requests: t.Optional[int] = None,
628
+ max_read_request_operation_count: t.Optional[int] = None,
629
+ max_read_request_size: t.Optional[t.Union[int, str]] = None,
630
+ max_retry_delay: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
631
+ max_write_buffer_count: t.Optional[int] = None,
632
+ max_write_buffer_size: t.Optional[t.Union[int, str]] = None,
633
+ max_write_request_operation_count: t.Optional[int] = None,
634
+ max_write_request_size: t.Optional[t.Union[int, str]] = None,
635
+ pretty: t.Optional[bool] = None,
636
+ read_poll_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
637
+ settings: t.Optional[t.Mapping[str, t.Any]] = None,
638
+ body: t.Optional[t.Dict[str, t.Any]] = None,
639
+ ) -> ObjectApiResponse[t.Any]:
640
+ """
641
+ .. raw:: html
642
+
643
+ <p>Create or update auto-follow patterns.
644
+ Create a collection of cross-cluster replication auto-follow patterns for a remote cluster.
645
+ Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices.
646
+ Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern.</p>
647
+ <p>This API can also be used to update auto-follow patterns.
648
+ NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns.</p>
649
+
650
+
651
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-put-auto-follow-pattern>`_
652
+
653
+ :param name: The name of the collection of auto-follow patterns.
654
+ :param remote_cluster: The remote cluster containing the leader indices to match
655
+ against.
656
+ :param follow_index_pattern: The name of follower index. The template {{leader_index}}
657
+ can be used to derive the name of the follower index from the name of the
658
+ leader index. When following a data stream, use {{leader_index}}; CCR does
659
+ not support changes to the names of a follower data stream’s backing indices.
660
+ :param leader_index_exclusion_patterns: An array of simple index patterns that
661
+ can be used to exclude indices from being auto-followed. Indices in the remote
662
+ cluster whose names are matching one or more leader_index_patterns and one
663
+ or more leader_index_exclusion_patterns won’t be followed.
664
+ :param leader_index_patterns: An array of simple index patterns to match against
665
+ indices in the remote cluster specified by the remote_cluster field.
666
+ :param master_timeout: Period to wait for a connection to the master node.
667
+ :param max_outstanding_read_requests: The maximum number of outstanding reads
668
+ requests from the remote cluster.
669
+ :param max_outstanding_write_requests: The maximum number of outstanding reads
670
+ requests from the remote cluster.
671
+ :param max_read_request_operation_count: The maximum number of operations to
672
+ pull per read from the remote cluster.
673
+ :param max_read_request_size: The maximum size in bytes of per read of a batch
674
+ of operations pulled from the remote cluster.
675
+ :param max_retry_delay: The maximum time to wait before retrying an operation
676
+ that failed exceptionally. An exponential backoff strategy is employed when
677
+ retrying.
678
+ :param max_write_buffer_count: The maximum number of operations that can be queued
679
+ for writing. When this limit is reached, reads from the remote cluster will
680
+ be deferred until the number of queued operations goes below the limit.
681
+ :param max_write_buffer_size: The maximum total bytes of operations that can
682
+ be queued for writing. When this limit is reached, reads from the remote
683
+ cluster will be deferred until the total bytes of queued operations goes
684
+ below the limit.
685
+ :param max_write_request_operation_count: The maximum number of operations per
686
+ bulk write request executed on the follower.
687
+ :param max_write_request_size: The maximum total bytes of operations per bulk
688
+ write request executed on the follower.
689
+ :param read_poll_timeout: The maximum time to wait for new operations on the
690
+ remote cluster when the follower index is synchronized with the leader index.
691
+ When the timeout has elapsed, the poll for operations will return to the
692
+ follower so that it can update some statistics. Then the follower will immediately
693
+ attempt to read from the leader again.
694
+ :param settings: Settings to override from the leader index. Note that certain
695
+ settings can not be overrode (e.g., index.number_of_shards).
696
+ """
697
+ if name in SKIP_IN_PATH:
698
+ raise ValueError("Empty value passed for parameter 'name'")
699
+ if remote_cluster is None and body is None:
700
+ raise ValueError("Empty value passed for parameter 'remote_cluster'")
701
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
702
+ __path = f'/_ccr/auto_follow/{__path_parts["name"]}'
703
+ __query: t.Dict[str, t.Any] = {}
704
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
705
+ if error_trace is not None:
706
+ __query["error_trace"] = error_trace
707
+ if filter_path is not None:
708
+ __query["filter_path"] = filter_path
709
+ if human is not None:
710
+ __query["human"] = human
711
+ if master_timeout is not None:
712
+ __query["master_timeout"] = master_timeout
713
+ if pretty is not None:
714
+ __query["pretty"] = pretty
715
+ if not __body:
716
+ if remote_cluster is not None:
717
+ __body["remote_cluster"] = remote_cluster
718
+ if follow_index_pattern is not None:
719
+ __body["follow_index_pattern"] = follow_index_pattern
720
+ if leader_index_exclusion_patterns is not None:
721
+ __body["leader_index_exclusion_patterns"] = (
722
+ leader_index_exclusion_patterns
723
+ )
724
+ if leader_index_patterns is not None:
725
+ __body["leader_index_patterns"] = leader_index_patterns
726
+ if max_outstanding_read_requests is not None:
727
+ __body["max_outstanding_read_requests"] = max_outstanding_read_requests
728
+ if max_outstanding_write_requests is not None:
729
+ __body["max_outstanding_write_requests"] = (
730
+ max_outstanding_write_requests
731
+ )
732
+ if max_read_request_operation_count is not None:
733
+ __body["max_read_request_operation_count"] = (
734
+ max_read_request_operation_count
735
+ )
736
+ if max_read_request_size is not None:
737
+ __body["max_read_request_size"] = max_read_request_size
738
+ if max_retry_delay is not None:
739
+ __body["max_retry_delay"] = max_retry_delay
740
+ if max_write_buffer_count is not None:
741
+ __body["max_write_buffer_count"] = max_write_buffer_count
742
+ if max_write_buffer_size is not None:
743
+ __body["max_write_buffer_size"] = max_write_buffer_size
744
+ if max_write_request_operation_count is not None:
745
+ __body["max_write_request_operation_count"] = (
746
+ max_write_request_operation_count
747
+ )
748
+ if max_write_request_size is not None:
749
+ __body["max_write_request_size"] = max_write_request_size
750
+ if read_poll_timeout is not None:
751
+ __body["read_poll_timeout"] = read_poll_timeout
752
+ if settings is not None:
753
+ __body["settings"] = settings
754
+ __headers = {"accept": "application/json", "content-type": "application/json"}
755
+ return self.perform_request( # type: ignore[return-value]
756
+ "PUT",
757
+ __path,
758
+ params=__query,
759
+ headers=__headers,
760
+ body=__body,
761
+ endpoint_id="ccr.put_auto_follow_pattern",
762
+ path_parts=__path_parts,
763
+ )
764
+
765
+ @_rewrite_parameters()
766
+ def resume_auto_follow_pattern(
767
+ self,
768
+ *,
769
+ name: str,
770
+ error_trace: t.Optional[bool] = None,
771
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
772
+ human: t.Optional[bool] = None,
773
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
774
+ pretty: t.Optional[bool] = None,
775
+ ) -> ObjectApiResponse[t.Any]:
776
+ """
777
+ .. raw:: html
778
+
779
+ <p>Resume an auto-follow pattern.</p>
780
+ <p>Resume a cross-cluster replication auto-follow pattern that was paused.
781
+ The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster.
782
+ Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim.</p>
783
+
784
+
785
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-resume-auto-follow-pattern>`_
786
+
787
+ :param name: The name of the auto-follow pattern to resume.
788
+ :param master_timeout: The period to wait for a connection to the master node.
789
+ If the master node is not available before the timeout expires, the request
790
+ fails and returns an error. It can also be set to `-1` to indicate that the
791
+ request should never timeout.
792
+ """
793
+ if name in SKIP_IN_PATH:
794
+ raise ValueError("Empty value passed for parameter 'name'")
795
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
796
+ __path = f'/_ccr/auto_follow/{__path_parts["name"]}/resume'
797
+ __query: t.Dict[str, t.Any] = {}
798
+ if error_trace is not None:
799
+ __query["error_trace"] = error_trace
800
+ if filter_path is not None:
801
+ __query["filter_path"] = filter_path
802
+ if human is not None:
803
+ __query["human"] = human
804
+ if master_timeout is not None:
805
+ __query["master_timeout"] = master_timeout
806
+ if pretty is not None:
807
+ __query["pretty"] = pretty
808
+ __headers = {"accept": "application/json"}
809
+ return self.perform_request( # type: ignore[return-value]
810
+ "POST",
811
+ __path,
812
+ params=__query,
813
+ headers=__headers,
814
+ endpoint_id="ccr.resume_auto_follow_pattern",
815
+ path_parts=__path_parts,
816
+ )
817
+
818
+ @_rewrite_parameters(
819
+ body_fields=(
820
+ "max_outstanding_read_requests",
821
+ "max_outstanding_write_requests",
822
+ "max_read_request_operation_count",
823
+ "max_read_request_size",
824
+ "max_retry_delay",
825
+ "max_write_buffer_count",
826
+ "max_write_buffer_size",
827
+ "max_write_request_operation_count",
828
+ "max_write_request_size",
829
+ "read_poll_timeout",
830
+ ),
831
+ )
832
+ def resume_follow(
833
+ self,
834
+ *,
835
+ index: str,
836
+ error_trace: t.Optional[bool] = None,
837
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
838
+ human: t.Optional[bool] = None,
839
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
840
+ max_outstanding_read_requests: t.Optional[int] = None,
841
+ max_outstanding_write_requests: t.Optional[int] = None,
842
+ max_read_request_operation_count: t.Optional[int] = None,
843
+ max_read_request_size: t.Optional[str] = None,
844
+ max_retry_delay: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
845
+ max_write_buffer_count: t.Optional[int] = None,
846
+ max_write_buffer_size: t.Optional[str] = None,
847
+ max_write_request_operation_count: t.Optional[int] = None,
848
+ max_write_request_size: t.Optional[str] = None,
849
+ pretty: t.Optional[bool] = None,
850
+ read_poll_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
851
+ body: t.Optional[t.Dict[str, t.Any]] = None,
852
+ ) -> ObjectApiResponse[t.Any]:
853
+ """
854
+ .. raw:: html
855
+
856
+ <p>Resume a follower.
857
+ Resume a cross-cluster replication follower index that was paused.
858
+ The follower index could have been paused with the pause follower API.
859
+ Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks.
860
+ When this API returns, the follower index will resume fetching operations from the leader index.</p>
861
+
862
+
863
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-resume-follow>`_
864
+
865
+ :param index: The name of the follow index to resume following.
866
+ :param master_timeout: Period to wait for a connection to the master node.
867
+ :param max_outstanding_read_requests:
868
+ :param max_outstanding_write_requests:
869
+ :param max_read_request_operation_count:
870
+ :param max_read_request_size:
871
+ :param max_retry_delay:
872
+ :param max_write_buffer_count:
873
+ :param max_write_buffer_size:
874
+ :param max_write_request_operation_count:
875
+ :param max_write_request_size:
876
+ :param read_poll_timeout:
877
+ """
878
+ if index in SKIP_IN_PATH:
879
+ raise ValueError("Empty value passed for parameter 'index'")
880
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
881
+ __path = f'/{__path_parts["index"]}/_ccr/resume_follow'
882
+ __query: t.Dict[str, t.Any] = {}
883
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
884
+ if error_trace is not None:
885
+ __query["error_trace"] = error_trace
886
+ if filter_path is not None:
887
+ __query["filter_path"] = filter_path
888
+ if human is not None:
889
+ __query["human"] = human
890
+ if master_timeout is not None:
891
+ __query["master_timeout"] = master_timeout
892
+ if pretty is not None:
893
+ __query["pretty"] = pretty
894
+ if not __body:
895
+ if max_outstanding_read_requests is not None:
896
+ __body["max_outstanding_read_requests"] = max_outstanding_read_requests
897
+ if max_outstanding_write_requests is not None:
898
+ __body["max_outstanding_write_requests"] = (
899
+ max_outstanding_write_requests
900
+ )
901
+ if max_read_request_operation_count is not None:
902
+ __body["max_read_request_operation_count"] = (
903
+ max_read_request_operation_count
904
+ )
905
+ if max_read_request_size is not None:
906
+ __body["max_read_request_size"] = max_read_request_size
907
+ if max_retry_delay is not None:
908
+ __body["max_retry_delay"] = max_retry_delay
909
+ if max_write_buffer_count is not None:
910
+ __body["max_write_buffer_count"] = max_write_buffer_count
911
+ if max_write_buffer_size is not None:
912
+ __body["max_write_buffer_size"] = max_write_buffer_size
913
+ if max_write_request_operation_count is not None:
914
+ __body["max_write_request_operation_count"] = (
915
+ max_write_request_operation_count
916
+ )
917
+ if max_write_request_size is not None:
918
+ __body["max_write_request_size"] = max_write_request_size
919
+ if read_poll_timeout is not None:
920
+ __body["read_poll_timeout"] = read_poll_timeout
921
+ if not __body:
922
+ __body = None # type: ignore[assignment]
923
+ __headers = {"accept": "application/json"}
924
+ if __body is not None:
925
+ __headers["content-type"] = "application/json"
926
+ return self.perform_request( # type: ignore[return-value]
927
+ "POST",
928
+ __path,
929
+ params=__query,
930
+ headers=__headers,
931
+ body=__body,
932
+ endpoint_id="ccr.resume_follow",
933
+ path_parts=__path_parts,
934
+ )
935
+
936
+ @_rewrite_parameters()
937
+ def stats(
938
+ self,
939
+ *,
940
+ error_trace: t.Optional[bool] = None,
941
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
942
+ human: t.Optional[bool] = None,
943
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
944
+ pretty: t.Optional[bool] = None,
945
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
946
+ ) -> ObjectApiResponse[t.Any]:
947
+ """
948
+ .. raw:: html
949
+
950
+ <p>Get cross-cluster replication stats.</p>
951
+ <p>This API returns stats about auto-following and the same shard-level stats as the get follower stats API.</p>
952
+
953
+
954
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-stats>`_
955
+
956
+ :param master_timeout: The period to wait for a connection to the master node.
957
+ If the master node is not available before the timeout expires, the request
958
+ fails and returns an error. It can also be set to `-1` to indicate that the
959
+ request should never timeout.
960
+ :param timeout: The period to wait for a response. If no response is received
961
+ before the timeout expires, the request fails and returns an error.
962
+ """
963
+ __path_parts: t.Dict[str, str] = {}
964
+ __path = "/_ccr/stats"
965
+ __query: t.Dict[str, t.Any] = {}
966
+ if error_trace is not None:
967
+ __query["error_trace"] = error_trace
968
+ if filter_path is not None:
969
+ __query["filter_path"] = filter_path
970
+ if human is not None:
971
+ __query["human"] = human
972
+ if master_timeout is not None:
973
+ __query["master_timeout"] = master_timeout
974
+ if pretty is not None:
975
+ __query["pretty"] = pretty
976
+ if timeout is not None:
977
+ __query["timeout"] = timeout
978
+ __headers = {"accept": "application/json"}
979
+ return self.perform_request( # type: ignore[return-value]
980
+ "GET",
981
+ __path,
982
+ params=__query,
983
+ headers=__headers,
984
+ endpoint_id="ccr.stats",
985
+ path_parts=__path_parts,
986
+ )
987
+
988
+ @_rewrite_parameters()
989
+ def unfollow(
990
+ self,
991
+ *,
992
+ index: str,
993
+ error_trace: t.Optional[bool] = None,
994
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
995
+ human: t.Optional[bool] = None,
996
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
997
+ pretty: t.Optional[bool] = None,
998
+ ) -> ObjectApiResponse[t.Any]:
999
+ """
1000
+ .. raw:: html
1001
+
1002
+ <p>Unfollow an index.</p>
1003
+ <p>Convert a cross-cluster replication follower index to a regular index.
1004
+ The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication.
1005
+ The follower index must be paused and closed before you call the unfollow API.</p>
1006
+ <blockquote>
1007
+ <p>info
1008
+ Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation.</p>
1009
+ </blockquote>
1010
+
1011
+
1012
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ccr-unfollow>`_
1013
+
1014
+ :param index: The name of the follower index.
1015
+ :param master_timeout: The period to wait for a connection to the master node.
1016
+ If the master node is not available before the timeout expires, the request
1017
+ fails and returns an error. It can also be set to `-1` to indicate that the
1018
+ request should never timeout.
1019
+ """
1020
+ if index in SKIP_IN_PATH:
1021
+ raise ValueError("Empty value passed for parameter 'index'")
1022
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
1023
+ __path = f'/{__path_parts["index"]}/_ccr/unfollow'
1024
+ __query: t.Dict[str, t.Any] = {}
1025
+ if error_trace is not None:
1026
+ __query["error_trace"] = error_trace
1027
+ if filter_path is not None:
1028
+ __query["filter_path"] = filter_path
1029
+ if human is not None:
1030
+ __query["human"] = human
1031
+ if master_timeout is not None:
1032
+ __query["master_timeout"] = master_timeout
1033
+ if pretty is not None:
1034
+ __query["pretty"] = pretty
1035
+ __headers = {"accept": "application/json"}
1036
+ return self.perform_request( # type: ignore[return-value]
1037
+ "POST",
1038
+ __path,
1039
+ params=__query,
1040
+ headers=__headers,
1041
+ endpoint_id="ccr.unfollow",
1042
+ path_parts=__path_parts,
1043
+ )