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,894 @@
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 WatcherClient(NamespacedClient):
27
+
28
+ @_rewrite_parameters()
29
+ def ack_watch(
30
+ self,
31
+ *,
32
+ watch_id: str,
33
+ action_id: t.Optional[t.Union[str, t.Sequence[str]]] = None,
34
+ error_trace: t.Optional[bool] = None,
35
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
36
+ human: t.Optional[bool] = None,
37
+ pretty: t.Optional[bool] = None,
38
+ ) -> ObjectApiResponse[t.Any]:
39
+ """
40
+ .. raw:: html
41
+
42
+ <p>Acknowledge a watch.
43
+ Acknowledging a watch enables you to manually throttle the execution of the watch's actions.</p>
44
+ <p>The acknowledgement state of an action is stored in the <code>status.actions.&lt;id&gt;.ack.state</code> structure.</p>
45
+ <p>IMPORTANT: If the specified watch is currently being executed, this API will return an error
46
+ The reason for this behavior is to prevent overwriting the watch status from a watch execution.</p>
47
+ <p>Acknowledging an action throttles further executions of that action until its <code>ack.state</code> is reset to <code>awaits_successful_execution</code>.
48
+ This happens when the condition of the watch is not met (the condition evaluates to false).</p>
49
+
50
+
51
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-ack-watch>`_
52
+
53
+ :param watch_id: The watch identifier.
54
+ :param action_id: A comma-separated list of the action identifiers to acknowledge.
55
+ If you omit this parameter, all of the actions of the watch are acknowledged.
56
+ """
57
+ if watch_id in SKIP_IN_PATH:
58
+ raise ValueError("Empty value passed for parameter 'watch_id'")
59
+ __path_parts: t.Dict[str, str]
60
+ if watch_id not in SKIP_IN_PATH and action_id not in SKIP_IN_PATH:
61
+ __path_parts = {
62
+ "watch_id": _quote(watch_id),
63
+ "action_id": _quote(action_id),
64
+ }
65
+ __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_ack/{__path_parts["action_id"]}'
66
+ elif watch_id not in SKIP_IN_PATH:
67
+ __path_parts = {"watch_id": _quote(watch_id)}
68
+ __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_ack'
69
+ else:
70
+ raise ValueError("Couldn't find a path for the given parameters")
71
+ __query: t.Dict[str, t.Any] = {}
72
+ if error_trace is not None:
73
+ __query["error_trace"] = error_trace
74
+ if filter_path is not None:
75
+ __query["filter_path"] = filter_path
76
+ if human is not None:
77
+ __query["human"] = human
78
+ if pretty is not None:
79
+ __query["pretty"] = pretty
80
+ __headers = {"accept": "application/json"}
81
+ return self.perform_request( # type: ignore[return-value]
82
+ "PUT",
83
+ __path,
84
+ params=__query,
85
+ headers=__headers,
86
+ endpoint_id="watcher.ack_watch",
87
+ path_parts=__path_parts,
88
+ )
89
+
90
+ @_rewrite_parameters()
91
+ def activate_watch(
92
+ self,
93
+ *,
94
+ watch_id: str,
95
+ error_trace: t.Optional[bool] = None,
96
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
97
+ human: t.Optional[bool] = None,
98
+ pretty: t.Optional[bool] = None,
99
+ ) -> ObjectApiResponse[t.Any]:
100
+ """
101
+ .. raw:: html
102
+
103
+ <p>Activate a watch.
104
+ A watch can be either active or inactive.</p>
105
+
106
+
107
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-activate-watch>`_
108
+
109
+ :param watch_id: The watch identifier.
110
+ """
111
+ if watch_id in SKIP_IN_PATH:
112
+ raise ValueError("Empty value passed for parameter 'watch_id'")
113
+ __path_parts: t.Dict[str, str] = {"watch_id": _quote(watch_id)}
114
+ __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_activate'
115
+ __query: t.Dict[str, t.Any] = {}
116
+ if error_trace is not None:
117
+ __query["error_trace"] = error_trace
118
+ if filter_path is not None:
119
+ __query["filter_path"] = filter_path
120
+ if human is not None:
121
+ __query["human"] = human
122
+ if pretty is not None:
123
+ __query["pretty"] = pretty
124
+ __headers = {"accept": "application/json"}
125
+ return self.perform_request( # type: ignore[return-value]
126
+ "PUT",
127
+ __path,
128
+ params=__query,
129
+ headers=__headers,
130
+ endpoint_id="watcher.activate_watch",
131
+ path_parts=__path_parts,
132
+ )
133
+
134
+ @_rewrite_parameters()
135
+ def deactivate_watch(
136
+ self,
137
+ *,
138
+ watch_id: str,
139
+ error_trace: t.Optional[bool] = None,
140
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
141
+ human: t.Optional[bool] = None,
142
+ pretty: t.Optional[bool] = None,
143
+ ) -> ObjectApiResponse[t.Any]:
144
+ """
145
+ .. raw:: html
146
+
147
+ <p>Deactivate a watch.
148
+ A watch can be either active or inactive.</p>
149
+
150
+
151
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-deactivate-watch>`_
152
+
153
+ :param watch_id: The watch identifier.
154
+ """
155
+ if watch_id in SKIP_IN_PATH:
156
+ raise ValueError("Empty value passed for parameter 'watch_id'")
157
+ __path_parts: t.Dict[str, str] = {"watch_id": _quote(watch_id)}
158
+ __path = f'/_watcher/watch/{__path_parts["watch_id"]}/_deactivate'
159
+ __query: t.Dict[str, t.Any] = {}
160
+ if error_trace is not None:
161
+ __query["error_trace"] = error_trace
162
+ if filter_path is not None:
163
+ __query["filter_path"] = filter_path
164
+ if human is not None:
165
+ __query["human"] = human
166
+ if pretty is not None:
167
+ __query["pretty"] = pretty
168
+ __headers = {"accept": "application/json"}
169
+ return self.perform_request( # type: ignore[return-value]
170
+ "PUT",
171
+ __path,
172
+ params=__query,
173
+ headers=__headers,
174
+ endpoint_id="watcher.deactivate_watch",
175
+ path_parts=__path_parts,
176
+ )
177
+
178
+ @_rewrite_parameters()
179
+ def delete_watch(
180
+ self,
181
+ *,
182
+ id: str,
183
+ error_trace: t.Optional[bool] = None,
184
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
185
+ human: t.Optional[bool] = None,
186
+ pretty: t.Optional[bool] = None,
187
+ ) -> ObjectApiResponse[t.Any]:
188
+ """
189
+ .. raw:: html
190
+
191
+ <p>Delete a watch.
192
+ When the watch is removed, the document representing the watch in the <code>.watches</code> index is gone and it will never be run again.</p>
193
+ <p>Deleting a watch does not delete any watch execution records related to this watch from the watch history.</p>
194
+ <p>IMPORTANT: Deleting a watch must be done by using only this API.
195
+ Do not delete the watch directly from the <code>.watches</code> index using the Elasticsearch delete document API
196
+ When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the <code>.watches</code> index.</p>
197
+
198
+
199
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-delete-watch>`_
200
+
201
+ :param id: The watch identifier.
202
+ """
203
+ if id in SKIP_IN_PATH:
204
+ raise ValueError("Empty value passed for parameter 'id'")
205
+ __path_parts: t.Dict[str, str] = {"id": _quote(id)}
206
+ __path = f'/_watcher/watch/{__path_parts["id"]}'
207
+ __query: t.Dict[str, t.Any] = {}
208
+ if error_trace is not None:
209
+ __query["error_trace"] = error_trace
210
+ if filter_path is not None:
211
+ __query["filter_path"] = filter_path
212
+ if human is not None:
213
+ __query["human"] = human
214
+ if pretty is not None:
215
+ __query["pretty"] = pretty
216
+ __headers = {"accept": "application/json"}
217
+ return self.perform_request( # type: ignore[return-value]
218
+ "DELETE",
219
+ __path,
220
+ params=__query,
221
+ headers=__headers,
222
+ endpoint_id="watcher.delete_watch",
223
+ path_parts=__path_parts,
224
+ )
225
+
226
+ @_rewrite_parameters(
227
+ body_fields=(
228
+ "action_modes",
229
+ "alternative_input",
230
+ "ignore_condition",
231
+ "record_execution",
232
+ "simulated_actions",
233
+ "trigger_data",
234
+ "watch",
235
+ ),
236
+ )
237
+ def execute_watch(
238
+ self,
239
+ *,
240
+ id: t.Optional[str] = None,
241
+ action_modes: t.Optional[
242
+ t.Mapping[
243
+ str,
244
+ t.Union[
245
+ str,
246
+ t.Literal[
247
+ "execute", "force_execute", "force_simulate", "simulate", "skip"
248
+ ],
249
+ ],
250
+ ]
251
+ ] = None,
252
+ alternative_input: t.Optional[t.Mapping[str, t.Any]] = None,
253
+ debug: t.Optional[bool] = None,
254
+ error_trace: t.Optional[bool] = None,
255
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
256
+ human: t.Optional[bool] = None,
257
+ ignore_condition: t.Optional[bool] = None,
258
+ pretty: t.Optional[bool] = None,
259
+ record_execution: t.Optional[bool] = None,
260
+ simulated_actions: t.Optional[t.Mapping[str, t.Any]] = None,
261
+ trigger_data: t.Optional[t.Mapping[str, t.Any]] = None,
262
+ watch: t.Optional[t.Mapping[str, t.Any]] = None,
263
+ body: t.Optional[t.Dict[str, t.Any]] = None,
264
+ ) -> ObjectApiResponse[t.Any]:
265
+ """
266
+ .. raw:: html
267
+
268
+ <p>Run a watch.
269
+ This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.</p>
270
+ <p>For testing and debugging purposes, you also have fine-grained control on how the watch runs.
271
+ You can run the watch without running all of its actions or alternatively by simulating them.
272
+ You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.</p>
273
+ <p>You can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.
274
+ This serves as great tool for testing and debugging your watches prior to adding them to Watcher.</p>
275
+ <p>When Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.
276
+ If your user is allowed to read index <code>a</code>, but not index <code>b</code>, then the exact same set of rules will apply during execution of a watch.</p>
277
+ <p>When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.</p>
278
+
279
+
280
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-execute-watch>`_
281
+
282
+ :param id: The watch identifier.
283
+ :param action_modes: Determines how to handle the watch actions as part of the
284
+ watch execution.
285
+ :param alternative_input: When present, the watch uses this object as a payload
286
+ instead of executing its own input.
287
+ :param debug: Defines whether the watch runs in debug mode.
288
+ :param ignore_condition: When set to `true`, the watch execution uses the always
289
+ condition. This can also be specified as an HTTP parameter.
290
+ :param record_execution: When set to `true`, the watch record representing the
291
+ watch execution result is persisted to the `.watcher-history` index for the
292
+ current time. In addition, the status of the watch is updated, possibly throttling
293
+ subsequent runs. This can also be specified as an HTTP parameter.
294
+ :param simulated_actions:
295
+ :param trigger_data: This structure is parsed as the data of the trigger event
296
+ that will be used during the watch execution.
297
+ :param watch: When present, this watch is used instead of the one specified in
298
+ the request. This watch is not persisted to the index and `record_execution`
299
+ cannot be set.
300
+ """
301
+ __path_parts: t.Dict[str, str]
302
+ if id not in SKIP_IN_PATH:
303
+ __path_parts = {"id": _quote(id)}
304
+ __path = f'/_watcher/watch/{__path_parts["id"]}/_execute'
305
+ else:
306
+ __path_parts = {}
307
+ __path = "/_watcher/watch/_execute"
308
+ __query: t.Dict[str, t.Any] = {}
309
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
310
+ if debug is not None:
311
+ __query["debug"] = debug
312
+ if error_trace is not None:
313
+ __query["error_trace"] = error_trace
314
+ if filter_path is not None:
315
+ __query["filter_path"] = filter_path
316
+ if human is not None:
317
+ __query["human"] = human
318
+ if pretty is not None:
319
+ __query["pretty"] = pretty
320
+ if not __body:
321
+ if action_modes is not None:
322
+ __body["action_modes"] = action_modes
323
+ if alternative_input is not None:
324
+ __body["alternative_input"] = alternative_input
325
+ if ignore_condition is not None:
326
+ __body["ignore_condition"] = ignore_condition
327
+ if record_execution is not None:
328
+ __body["record_execution"] = record_execution
329
+ if simulated_actions is not None:
330
+ __body["simulated_actions"] = simulated_actions
331
+ if trigger_data is not None:
332
+ __body["trigger_data"] = trigger_data
333
+ if watch is not None:
334
+ __body["watch"] = watch
335
+ if not __body:
336
+ __body = None # type: ignore[assignment]
337
+ __headers = {"accept": "application/json"}
338
+ if __body is not None:
339
+ __headers["content-type"] = "application/json"
340
+ return self.perform_request( # type: ignore[return-value]
341
+ "PUT",
342
+ __path,
343
+ params=__query,
344
+ headers=__headers,
345
+ body=__body,
346
+ endpoint_id="watcher.execute_watch",
347
+ path_parts=__path_parts,
348
+ )
349
+
350
+ @_rewrite_parameters()
351
+ def get_settings(
352
+ self,
353
+ *,
354
+ error_trace: t.Optional[bool] = None,
355
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
356
+ human: t.Optional[bool] = None,
357
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
358
+ pretty: t.Optional[bool] = None,
359
+ ) -> ObjectApiResponse[t.Any]:
360
+ """
361
+ .. raw:: html
362
+
363
+ <p>Get Watcher index settings.
364
+ Get settings for the Watcher internal index (<code>.watches</code>).
365
+ Only a subset of settings are shown, for example <code>index.auto_expand_replicas</code> and <code>index.number_of_replicas</code>.</p>
366
+
367
+
368
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-get-settings>`_
369
+
370
+ :param master_timeout: The period to wait for a connection to the master node.
371
+ If no response is received before the timeout expires, the request fails
372
+ and returns an error.
373
+ """
374
+ __path_parts: t.Dict[str, str] = {}
375
+ __path = "/_watcher/settings"
376
+ __query: t.Dict[str, t.Any] = {}
377
+ if error_trace is not None:
378
+ __query["error_trace"] = error_trace
379
+ if filter_path is not None:
380
+ __query["filter_path"] = filter_path
381
+ if human is not None:
382
+ __query["human"] = human
383
+ if master_timeout is not None:
384
+ __query["master_timeout"] = master_timeout
385
+ if pretty is not None:
386
+ __query["pretty"] = pretty
387
+ __headers = {"accept": "application/json"}
388
+ return self.perform_request( # type: ignore[return-value]
389
+ "GET",
390
+ __path,
391
+ params=__query,
392
+ headers=__headers,
393
+ endpoint_id="watcher.get_settings",
394
+ path_parts=__path_parts,
395
+ )
396
+
397
+ @_rewrite_parameters()
398
+ def get_watch(
399
+ self,
400
+ *,
401
+ id: str,
402
+ error_trace: t.Optional[bool] = None,
403
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
404
+ human: t.Optional[bool] = None,
405
+ pretty: t.Optional[bool] = None,
406
+ ) -> ObjectApiResponse[t.Any]:
407
+ """
408
+ .. raw:: html
409
+
410
+ <p>Get a watch.</p>
411
+
412
+
413
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-get-watch>`_
414
+
415
+ :param id: The watch identifier.
416
+ """
417
+ if id in SKIP_IN_PATH:
418
+ raise ValueError("Empty value passed for parameter 'id'")
419
+ __path_parts: t.Dict[str, str] = {"id": _quote(id)}
420
+ __path = f'/_watcher/watch/{__path_parts["id"]}'
421
+ __query: t.Dict[str, t.Any] = {}
422
+ if error_trace is not None:
423
+ __query["error_trace"] = error_trace
424
+ if filter_path is not None:
425
+ __query["filter_path"] = filter_path
426
+ if human is not None:
427
+ __query["human"] = human
428
+ if pretty is not None:
429
+ __query["pretty"] = pretty
430
+ __headers = {"accept": "application/json"}
431
+ return self.perform_request( # type: ignore[return-value]
432
+ "GET",
433
+ __path,
434
+ params=__query,
435
+ headers=__headers,
436
+ endpoint_id="watcher.get_watch",
437
+ path_parts=__path_parts,
438
+ )
439
+
440
+ @_rewrite_parameters(
441
+ body_fields=(
442
+ "actions",
443
+ "condition",
444
+ "input",
445
+ "metadata",
446
+ "throttle_period",
447
+ "throttle_period_in_millis",
448
+ "transform",
449
+ "trigger",
450
+ ),
451
+ )
452
+ def put_watch(
453
+ self,
454
+ *,
455
+ id: str,
456
+ actions: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
457
+ active: t.Optional[bool] = None,
458
+ condition: t.Optional[t.Mapping[str, t.Any]] = None,
459
+ error_trace: t.Optional[bool] = None,
460
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
461
+ human: t.Optional[bool] = None,
462
+ if_primary_term: t.Optional[int] = None,
463
+ if_seq_no: t.Optional[int] = None,
464
+ input: t.Optional[t.Mapping[str, t.Any]] = None,
465
+ metadata: t.Optional[t.Mapping[str, t.Any]] = None,
466
+ pretty: t.Optional[bool] = None,
467
+ throttle_period: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
468
+ throttle_period_in_millis: t.Optional[t.Any] = None,
469
+ transform: t.Optional[t.Mapping[str, t.Any]] = None,
470
+ trigger: t.Optional[t.Mapping[str, t.Any]] = None,
471
+ version: t.Optional[int] = None,
472
+ body: t.Optional[t.Dict[str, t.Any]] = None,
473
+ ) -> ObjectApiResponse[t.Any]:
474
+ """
475
+ .. raw:: html
476
+
477
+ <p>Create or update a watch.
478
+ When a watch is registered, a new document that represents the watch is added to the <code>.watches</code> index and its trigger is immediately registered with the relevant trigger engine.
479
+ Typically for the <code>schedule</code> trigger, the scheduler is the trigger engine.</p>
480
+ <p>IMPORTANT: You must use Kibana or this API to create a watch.
481
+ Do not add a watch directly to the <code>.watches</code> index by using the Elasticsearch index API.
482
+ If Elasticsearch security features are enabled, do not give users write privileges on the <code>.watches</code> index.</p>
483
+ <p>When you add a watch you can also define its initial active state by setting the <em>active</em> parameter.</p>
484
+ <p>When Elasticsearch security features are enabled, your watch can index or search only on indices for which the user that stored the watch has privileges.
485
+ If the user is able to read index <code>a</code>, but not index <code>b</code>, the same will apply when the watch runs.</p>
486
+
487
+
488
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-put-watch>`_
489
+
490
+ :param id: The identifier for the watch.
491
+ :param actions: The list of actions that will be run if the condition matches.
492
+ :param active: The initial state of the watch. The default value is `true`, which
493
+ means the watch is active by default.
494
+ :param condition: The condition that defines if the actions should be run.
495
+ :param if_primary_term: only update the watch if the last operation that has
496
+ changed the watch has the specified primary term
497
+ :param if_seq_no: only update the watch if the last operation that has changed
498
+ the watch has the specified sequence number
499
+ :param input: The input that defines the input that loads the data for the watch.
500
+ :param metadata: Metadata JSON that will be copied into the history entries.
501
+ :param throttle_period: The minimum time between actions being run. The default
502
+ is 5 seconds. This default can be changed in the config file with the setting
503
+ `xpack.watcher.throttle.period.default_period`. If both this value and the
504
+ `throttle_period_in_millis` parameter are specified, Watcher uses the last
505
+ parameter included in the request.
506
+ :param throttle_period_in_millis: Minimum time in milliseconds between actions
507
+ being run. Defaults to 5000. If both this value and the throttle_period parameter
508
+ are specified, Watcher uses the last parameter included in the request.
509
+ :param transform: The transform that processes the watch payload to prepare it
510
+ for the watch actions.
511
+ :param trigger: The trigger that defines when the watch should run.
512
+ :param version: Explicit version number for concurrency control
513
+ """
514
+ if id in SKIP_IN_PATH:
515
+ raise ValueError("Empty value passed for parameter 'id'")
516
+ __path_parts: t.Dict[str, str] = {"id": _quote(id)}
517
+ __path = f'/_watcher/watch/{__path_parts["id"]}'
518
+ __query: t.Dict[str, t.Any] = {}
519
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
520
+ if active is not None:
521
+ __query["active"] = active
522
+ if error_trace is not None:
523
+ __query["error_trace"] = error_trace
524
+ if filter_path is not None:
525
+ __query["filter_path"] = filter_path
526
+ if human is not None:
527
+ __query["human"] = human
528
+ if if_primary_term is not None:
529
+ __query["if_primary_term"] = if_primary_term
530
+ if if_seq_no is not None:
531
+ __query["if_seq_no"] = if_seq_no
532
+ if pretty is not None:
533
+ __query["pretty"] = pretty
534
+ if version is not None:
535
+ __query["version"] = version
536
+ if not __body:
537
+ if actions is not None:
538
+ __body["actions"] = actions
539
+ if condition is not None:
540
+ __body["condition"] = condition
541
+ if input is not None:
542
+ __body["input"] = input
543
+ if metadata is not None:
544
+ __body["metadata"] = metadata
545
+ if throttle_period is not None:
546
+ __body["throttle_period"] = throttle_period
547
+ if throttle_period_in_millis is not None:
548
+ __body["throttle_period_in_millis"] = throttle_period_in_millis
549
+ if transform is not None:
550
+ __body["transform"] = transform
551
+ if trigger is not None:
552
+ __body["trigger"] = trigger
553
+ if not __body:
554
+ __body = None # type: ignore[assignment]
555
+ __headers = {"accept": "application/json"}
556
+ if __body is not None:
557
+ __headers["content-type"] = "application/json"
558
+ return self.perform_request( # type: ignore[return-value]
559
+ "PUT",
560
+ __path,
561
+ params=__query,
562
+ headers=__headers,
563
+ body=__body,
564
+ endpoint_id="watcher.put_watch",
565
+ path_parts=__path_parts,
566
+ )
567
+
568
+ @_rewrite_parameters(
569
+ body_fields=("from_", "query", "search_after", "size", "sort"),
570
+ parameter_aliases={"from": "from_"},
571
+ )
572
+ def query_watches(
573
+ self,
574
+ *,
575
+ error_trace: t.Optional[bool] = None,
576
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
577
+ from_: t.Optional[int] = None,
578
+ human: t.Optional[bool] = None,
579
+ pretty: t.Optional[bool] = None,
580
+ query: t.Optional[t.Mapping[str, t.Any]] = None,
581
+ search_after: t.Optional[
582
+ t.Sequence[t.Union[None, bool, float, int, str]]
583
+ ] = None,
584
+ size: t.Optional[int] = None,
585
+ sort: t.Optional[
586
+ t.Union[
587
+ t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
588
+ t.Union[str, t.Mapping[str, t.Any]],
589
+ ]
590
+ ] = None,
591
+ body: t.Optional[t.Dict[str, t.Any]] = None,
592
+ ) -> ObjectApiResponse[t.Any]:
593
+ """
594
+ .. raw:: html
595
+
596
+ <p>Query watches.
597
+ Get all registered watches in a paginated manner and optionally filter watches by a query.</p>
598
+ <p>Note that only the <code>_id</code> and <code>metadata.*</code> fields are queryable or sortable.</p>
599
+
600
+
601
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-query-watches>`_
602
+
603
+ :param from_: The offset from the first result to fetch. It must be non-negative.
604
+ :param query: A query that filters the watches to be returned.
605
+ :param search_after: Retrieve the next page of hits using a set of sort values
606
+ from the previous page.
607
+ :param size: The number of hits to return. It must be non-negative.
608
+ :param sort: One or more fields used to sort the search results.
609
+ """
610
+ __path_parts: t.Dict[str, str] = {}
611
+ __path = "/_watcher/_query/watches"
612
+ __query: t.Dict[str, t.Any] = {}
613
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
614
+ # The 'sort' parameter with a colon can't be encoded to the body.
615
+ if sort is not None and (
616
+ (isinstance(sort, str) and ":" in sort)
617
+ or (
618
+ isinstance(sort, (list, tuple))
619
+ and all(isinstance(_x, str) for _x in sort)
620
+ and any(":" in _x for _x in sort)
621
+ )
622
+ ):
623
+ __query["sort"] = sort
624
+ sort = None
625
+ if error_trace is not None:
626
+ __query["error_trace"] = error_trace
627
+ if filter_path is not None:
628
+ __query["filter_path"] = filter_path
629
+ if human is not None:
630
+ __query["human"] = human
631
+ if pretty is not None:
632
+ __query["pretty"] = pretty
633
+ if not __body:
634
+ if from_ is not None:
635
+ __body["from"] = from_
636
+ if query is not None:
637
+ __body["query"] = query
638
+ if search_after is not None:
639
+ __body["search_after"] = search_after
640
+ if size is not None:
641
+ __body["size"] = size
642
+ if sort is not None:
643
+ __body["sort"] = sort
644
+ if not __body:
645
+ __body = None # type: ignore[assignment]
646
+ __headers = {"accept": "application/json"}
647
+ if __body is not None:
648
+ __headers["content-type"] = "application/json"
649
+ return self.perform_request( # type: ignore[return-value]
650
+ "POST",
651
+ __path,
652
+ params=__query,
653
+ headers=__headers,
654
+ body=__body,
655
+ endpoint_id="watcher.query_watches",
656
+ path_parts=__path_parts,
657
+ )
658
+
659
+ @_rewrite_parameters()
660
+ def start(
661
+ self,
662
+ *,
663
+ error_trace: t.Optional[bool] = None,
664
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
665
+ human: t.Optional[bool] = None,
666
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
667
+ pretty: t.Optional[bool] = None,
668
+ ) -> ObjectApiResponse[t.Any]:
669
+ """
670
+ .. raw:: html
671
+
672
+ <p>Start the watch service.
673
+ Start the Watcher service if it is not already running.</p>
674
+
675
+
676
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-start>`_
677
+
678
+ :param master_timeout: Period to wait for a connection to the master node.
679
+ """
680
+ __path_parts: t.Dict[str, str] = {}
681
+ __path = "/_watcher/_start"
682
+ __query: t.Dict[str, t.Any] = {}
683
+ if error_trace is not None:
684
+ __query["error_trace"] = error_trace
685
+ if filter_path is not None:
686
+ __query["filter_path"] = filter_path
687
+ if human is not None:
688
+ __query["human"] = human
689
+ if master_timeout is not None:
690
+ __query["master_timeout"] = master_timeout
691
+ if pretty is not None:
692
+ __query["pretty"] = pretty
693
+ __headers = {"accept": "application/json"}
694
+ return self.perform_request( # type: ignore[return-value]
695
+ "POST",
696
+ __path,
697
+ params=__query,
698
+ headers=__headers,
699
+ endpoint_id="watcher.start",
700
+ path_parts=__path_parts,
701
+ )
702
+
703
+ @_rewrite_parameters()
704
+ def stats(
705
+ self,
706
+ *,
707
+ metric: t.Optional[
708
+ t.Union[
709
+ t.Sequence[
710
+ t.Union[
711
+ str,
712
+ t.Literal[
713
+ "_all",
714
+ "current_watches",
715
+ "pending_watches",
716
+ "queued_watches",
717
+ ],
718
+ ]
719
+ ],
720
+ t.Union[
721
+ str,
722
+ t.Literal[
723
+ "_all", "current_watches", "pending_watches", "queued_watches"
724
+ ],
725
+ ],
726
+ ]
727
+ ] = None,
728
+ emit_stacktraces: t.Optional[bool] = None,
729
+ error_trace: t.Optional[bool] = None,
730
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
731
+ human: t.Optional[bool] = None,
732
+ pretty: t.Optional[bool] = None,
733
+ ) -> ObjectApiResponse[t.Any]:
734
+ """
735
+ .. raw:: html
736
+
737
+ <p>Get Watcher statistics.
738
+ This API always returns basic metrics.
739
+ You retrieve more metrics by using the metric parameter.</p>
740
+
741
+
742
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-stats>`_
743
+
744
+ :param metric: Defines which additional metrics are included in the response.
745
+ :param emit_stacktraces: Defines whether stack traces are generated for each
746
+ watch that is running.
747
+ """
748
+ __path_parts: t.Dict[str, str]
749
+ if metric not in SKIP_IN_PATH:
750
+ __path_parts = {"metric": _quote(metric)}
751
+ __path = f'/_watcher/stats/{__path_parts["metric"]}'
752
+ else:
753
+ __path_parts = {}
754
+ __path = "/_watcher/stats"
755
+ __query: t.Dict[str, t.Any] = {}
756
+ if emit_stacktraces is not None:
757
+ __query["emit_stacktraces"] = emit_stacktraces
758
+ if error_trace is not None:
759
+ __query["error_trace"] = error_trace
760
+ if filter_path is not None:
761
+ __query["filter_path"] = filter_path
762
+ if human is not None:
763
+ __query["human"] = human
764
+ if pretty is not None:
765
+ __query["pretty"] = pretty
766
+ __headers = {"accept": "application/json"}
767
+ return self.perform_request( # type: ignore[return-value]
768
+ "GET",
769
+ __path,
770
+ params=__query,
771
+ headers=__headers,
772
+ endpoint_id="watcher.stats",
773
+ path_parts=__path_parts,
774
+ )
775
+
776
+ @_rewrite_parameters()
777
+ def stop(
778
+ self,
779
+ *,
780
+ error_trace: t.Optional[bool] = None,
781
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
782
+ human: t.Optional[bool] = None,
783
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
784
+ pretty: t.Optional[bool] = None,
785
+ ) -> ObjectApiResponse[t.Any]:
786
+ """
787
+ .. raw:: html
788
+
789
+ <p>Stop the watch service.
790
+ Stop the Watcher service if it is running.</p>
791
+
792
+
793
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-stop>`_
794
+
795
+ :param master_timeout: The period to wait for the master node. If the master
796
+ node is not available before the timeout expires, the request fails and returns
797
+ an error. To indicate that the request should never timeout, set it to `-1`.
798
+ """
799
+ __path_parts: t.Dict[str, str] = {}
800
+ __path = "/_watcher/_stop"
801
+ __query: t.Dict[str, t.Any] = {}
802
+ if error_trace is not None:
803
+ __query["error_trace"] = error_trace
804
+ if filter_path is not None:
805
+ __query["filter_path"] = filter_path
806
+ if human is not None:
807
+ __query["human"] = human
808
+ if master_timeout is not None:
809
+ __query["master_timeout"] = master_timeout
810
+ if pretty is not None:
811
+ __query["pretty"] = pretty
812
+ __headers = {"accept": "application/json"}
813
+ return self.perform_request( # type: ignore[return-value]
814
+ "POST",
815
+ __path,
816
+ params=__query,
817
+ headers=__headers,
818
+ endpoint_id="watcher.stop",
819
+ path_parts=__path_parts,
820
+ )
821
+
822
+ @_rewrite_parameters(
823
+ body_fields=("index_auto_expand_replicas", "index_number_of_replicas"),
824
+ parameter_aliases={
825
+ "index.auto_expand_replicas": "index_auto_expand_replicas",
826
+ "index.number_of_replicas": "index_number_of_replicas",
827
+ },
828
+ )
829
+ def update_settings(
830
+ self,
831
+ *,
832
+ error_trace: t.Optional[bool] = None,
833
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
834
+ human: t.Optional[bool] = None,
835
+ index_auto_expand_replicas: t.Optional[str] = None,
836
+ index_number_of_replicas: t.Optional[int] = None,
837
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
838
+ pretty: t.Optional[bool] = None,
839
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
840
+ body: t.Optional[t.Dict[str, t.Any]] = None,
841
+ ) -> ObjectApiResponse[t.Any]:
842
+ """
843
+ .. raw:: html
844
+
845
+ <p>Update Watcher index settings.
846
+ Update settings for the Watcher internal index (<code>.watches</code>).
847
+ Only a subset of settings can be modified.
848
+ This includes <code>index.auto_expand_replicas</code>, <code>index.number_of_replicas</code>, <code>index.routing.allocation.exclude.*</code>,
849
+ <code>index.routing.allocation.include.*</code> and <code>index.routing.allocation.require.*</code>.
850
+ Modification of <code>index.routing.allocation.include._tier_preference</code> is an exception and is not allowed as the
851
+ Watcher shards must always be in the <code>data_content</code> tier.</p>
852
+
853
+
854
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-watcher-update-settings>`_
855
+
856
+ :param index_auto_expand_replicas:
857
+ :param index_number_of_replicas:
858
+ :param master_timeout: The period to wait for a connection to the master node.
859
+ If no response is received before the timeout expires, the request fails
860
+ and returns an error.
861
+ :param timeout: The period to wait for a response. If no response is received
862
+ before the timeout expires, the request fails and returns an error.
863
+ """
864
+ __path_parts: t.Dict[str, str] = {}
865
+ __path = "/_watcher/settings"
866
+ __query: t.Dict[str, t.Any] = {}
867
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
868
+ if error_trace is not None:
869
+ __query["error_trace"] = error_trace
870
+ if filter_path is not None:
871
+ __query["filter_path"] = filter_path
872
+ if human is not None:
873
+ __query["human"] = human
874
+ if master_timeout is not None:
875
+ __query["master_timeout"] = master_timeout
876
+ if pretty is not None:
877
+ __query["pretty"] = pretty
878
+ if timeout is not None:
879
+ __query["timeout"] = timeout
880
+ if not __body:
881
+ if index_auto_expand_replicas is not None:
882
+ __body["index.auto_expand_replicas"] = index_auto_expand_replicas
883
+ if index_number_of_replicas is not None:
884
+ __body["index.number_of_replicas"] = index_number_of_replicas
885
+ __headers = {"accept": "application/json", "content-type": "application/json"}
886
+ return self.perform_request( # type: ignore[return-value]
887
+ "PUT",
888
+ __path,
889
+ params=__query,
890
+ headers=__headers,
891
+ body=__body,
892
+ endpoint_id="watcher.update_settings",
893
+ path_parts=__path_parts,
894
+ )