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,559 @@
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 SlmClient(NamespacedClient):
27
+
28
+ @_rewrite_parameters()
29
+ async def delete_lifecycle(
30
+ self,
31
+ *,
32
+ policy_id: 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
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
39
+ ) -> ObjectApiResponse[t.Any]:
40
+ """
41
+ .. raw:: html
42
+
43
+ <p>Delete a policy.
44
+ Delete a snapshot lifecycle policy definition.
45
+ This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots.</p>
46
+
47
+
48
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-slm-delete-lifecycle>`_
49
+
50
+ :param policy_id: The id of the snapshot lifecycle policy to remove
51
+ :param master_timeout: The period to wait for a connection to the master node.
52
+ If no response is received before the timeout expires, the request fails
53
+ and returns an error.
54
+ :param timeout: The period to wait for a response. If no response is received
55
+ before the timeout expires, the request fails and returns an error.
56
+ """
57
+ if policy_id in SKIP_IN_PATH:
58
+ raise ValueError("Empty value passed for parameter 'policy_id'")
59
+ __path_parts: t.Dict[str, str] = {"policy_id": _quote(policy_id)}
60
+ __path = f'/_slm/policy/{__path_parts["policy_id"]}'
61
+ __query: t.Dict[str, t.Any] = {}
62
+ if error_trace is not None:
63
+ __query["error_trace"] = error_trace
64
+ if filter_path is not None:
65
+ __query["filter_path"] = filter_path
66
+ if human is not None:
67
+ __query["human"] = human
68
+ if master_timeout is not None:
69
+ __query["master_timeout"] = master_timeout
70
+ if pretty is not None:
71
+ __query["pretty"] = pretty
72
+ if timeout is not None:
73
+ __query["timeout"] = timeout
74
+ __headers = {"accept": "application/json"}
75
+ return await self.perform_request( # type: ignore[return-value]
76
+ "DELETE",
77
+ __path,
78
+ params=__query,
79
+ headers=__headers,
80
+ endpoint_id="slm.delete_lifecycle",
81
+ path_parts=__path_parts,
82
+ )
83
+
84
+ @_rewrite_parameters()
85
+ async def execute_lifecycle(
86
+ self,
87
+ *,
88
+ policy_id: str,
89
+ error_trace: t.Optional[bool] = None,
90
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
91
+ human: t.Optional[bool] = None,
92
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
93
+ pretty: t.Optional[bool] = None,
94
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
95
+ ) -> ObjectApiResponse[t.Any]:
96
+ """
97
+ .. raw:: html
98
+
99
+ <p>Run a policy.
100
+ Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time.
101
+ The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance.</p>
102
+
103
+
104
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-slm-execute-lifecycle>`_
105
+
106
+ :param policy_id: The id of the snapshot lifecycle policy to be executed
107
+ :param master_timeout: The period to wait for a connection to the master node.
108
+ If no response is received before the timeout expires, the request fails
109
+ and returns an error.
110
+ :param timeout: The period to wait for a response. If no response is received
111
+ before the timeout expires, the request fails and returns an error.
112
+ """
113
+ if policy_id in SKIP_IN_PATH:
114
+ raise ValueError("Empty value passed for parameter 'policy_id'")
115
+ __path_parts: t.Dict[str, str] = {"policy_id": _quote(policy_id)}
116
+ __path = f'/_slm/policy/{__path_parts["policy_id"]}/_execute'
117
+ __query: t.Dict[str, t.Any] = {}
118
+ if error_trace is not None:
119
+ __query["error_trace"] = error_trace
120
+ if filter_path is not None:
121
+ __query["filter_path"] = filter_path
122
+ if human is not None:
123
+ __query["human"] = human
124
+ if master_timeout is not None:
125
+ __query["master_timeout"] = master_timeout
126
+ if pretty is not None:
127
+ __query["pretty"] = pretty
128
+ if timeout is not None:
129
+ __query["timeout"] = timeout
130
+ __headers = {"accept": "application/json"}
131
+ return await self.perform_request( # type: ignore[return-value]
132
+ "PUT",
133
+ __path,
134
+ params=__query,
135
+ headers=__headers,
136
+ endpoint_id="slm.execute_lifecycle",
137
+ path_parts=__path_parts,
138
+ )
139
+
140
+ @_rewrite_parameters()
141
+ async def execute_retention(
142
+ self,
143
+ *,
144
+ error_trace: t.Optional[bool] = None,
145
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
146
+ human: t.Optional[bool] = None,
147
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
148
+ pretty: t.Optional[bool] = None,
149
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
150
+ ) -> ObjectApiResponse[t.Any]:
151
+ """
152
+ .. raw:: html
153
+
154
+ <p>Run a retention policy.
155
+ Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules.
156
+ The retention policy is normally applied according to its schedule.</p>
157
+
158
+
159
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-slm-execute-retention>`_
160
+
161
+ :param master_timeout: The period to wait for a connection to the master node.
162
+ If no response is received before the timeout expires, the request fails
163
+ and returns an error.
164
+ :param timeout: The period to wait for a response. If no response is received
165
+ before the timeout expires, the request fails and returns an error.
166
+ """
167
+ __path_parts: t.Dict[str, str] = {}
168
+ __path = "/_slm/_execute_retention"
169
+ __query: t.Dict[str, t.Any] = {}
170
+ if error_trace is not None:
171
+ __query["error_trace"] = error_trace
172
+ if filter_path is not None:
173
+ __query["filter_path"] = filter_path
174
+ if human is not None:
175
+ __query["human"] = human
176
+ if master_timeout is not None:
177
+ __query["master_timeout"] = master_timeout
178
+ if pretty is not None:
179
+ __query["pretty"] = pretty
180
+ if timeout is not None:
181
+ __query["timeout"] = timeout
182
+ __headers = {"accept": "application/json"}
183
+ return await self.perform_request( # type: ignore[return-value]
184
+ "POST",
185
+ __path,
186
+ params=__query,
187
+ headers=__headers,
188
+ endpoint_id="slm.execute_retention",
189
+ path_parts=__path_parts,
190
+ )
191
+
192
+ @_rewrite_parameters()
193
+ async def get_lifecycle(
194
+ self,
195
+ *,
196
+ policy_id: t.Optional[t.Union[str, t.Sequence[str]]] = None,
197
+ error_trace: t.Optional[bool] = None,
198
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
199
+ human: t.Optional[bool] = None,
200
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
201
+ pretty: t.Optional[bool] = None,
202
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
203
+ ) -> ObjectApiResponse[t.Any]:
204
+ """
205
+ .. raw:: html
206
+
207
+ <p>Get policy information.
208
+ Get snapshot lifecycle policy definitions and information about the latest snapshot attempts.</p>
209
+
210
+
211
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-slm-get-lifecycle>`_
212
+
213
+ :param policy_id: Comma-separated list of snapshot lifecycle policies to retrieve
214
+ :param master_timeout: The period to wait for a connection to the master node.
215
+ If no response is received before the timeout expires, the request fails
216
+ and returns an error.
217
+ :param timeout: The period to wait for a response. If no response is received
218
+ before the timeout expires, the request fails and returns an error.
219
+ """
220
+ __path_parts: t.Dict[str, str]
221
+ if policy_id not in SKIP_IN_PATH:
222
+ __path_parts = {"policy_id": _quote(policy_id)}
223
+ __path = f'/_slm/policy/{__path_parts["policy_id"]}'
224
+ else:
225
+ __path_parts = {}
226
+ __path = "/_slm/policy"
227
+ __query: t.Dict[str, t.Any] = {}
228
+ if error_trace is not None:
229
+ __query["error_trace"] = error_trace
230
+ if filter_path is not None:
231
+ __query["filter_path"] = filter_path
232
+ if human is not None:
233
+ __query["human"] = human
234
+ if master_timeout is not None:
235
+ __query["master_timeout"] = master_timeout
236
+ if pretty is not None:
237
+ __query["pretty"] = pretty
238
+ if timeout is not None:
239
+ __query["timeout"] = timeout
240
+ __headers = {"accept": "application/json"}
241
+ return await self.perform_request( # type: ignore[return-value]
242
+ "GET",
243
+ __path,
244
+ params=__query,
245
+ headers=__headers,
246
+ endpoint_id="slm.get_lifecycle",
247
+ path_parts=__path_parts,
248
+ )
249
+
250
+ @_rewrite_parameters()
251
+ async def get_stats(
252
+ self,
253
+ *,
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
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
258
+ pretty: t.Optional[bool] = None,
259
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
260
+ ) -> ObjectApiResponse[t.Any]:
261
+ """
262
+ .. raw:: html
263
+
264
+ <p>Get snapshot lifecycle management statistics.
265
+ Get global and policy-level statistics about actions taken by snapshot lifecycle management.</p>
266
+
267
+
268
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-slm-get-stats>`_
269
+
270
+ :param master_timeout: Period to wait for a connection to the master node. If
271
+ no response is received before the timeout expires, the request fails and
272
+ returns an error.
273
+ :param timeout: Period to wait for a response. If no response is received before
274
+ the timeout expires, the request fails and returns an error.
275
+ """
276
+ __path_parts: t.Dict[str, str] = {}
277
+ __path = "/_slm/stats"
278
+ __query: t.Dict[str, t.Any] = {}
279
+ if error_trace is not None:
280
+ __query["error_trace"] = error_trace
281
+ if filter_path is not None:
282
+ __query["filter_path"] = filter_path
283
+ if human is not None:
284
+ __query["human"] = human
285
+ if master_timeout is not None:
286
+ __query["master_timeout"] = master_timeout
287
+ if pretty is not None:
288
+ __query["pretty"] = pretty
289
+ if timeout is not None:
290
+ __query["timeout"] = timeout
291
+ __headers = {"accept": "application/json"}
292
+ return await self.perform_request( # type: ignore[return-value]
293
+ "GET",
294
+ __path,
295
+ params=__query,
296
+ headers=__headers,
297
+ endpoint_id="slm.get_stats",
298
+ path_parts=__path_parts,
299
+ )
300
+
301
+ @_rewrite_parameters()
302
+ async def get_status(
303
+ self,
304
+ *,
305
+ error_trace: t.Optional[bool] = None,
306
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
307
+ human: t.Optional[bool] = None,
308
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
309
+ pretty: t.Optional[bool] = None,
310
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
311
+ ) -> ObjectApiResponse[t.Any]:
312
+ """
313
+ .. raw:: html
314
+
315
+ <p>Get the snapshot lifecycle management status.</p>
316
+
317
+
318
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-slm-get-status>`_
319
+
320
+ :param master_timeout: The period to wait for a connection to the master node.
321
+ If no response is received before the timeout expires, the request fails
322
+ and returns an error. To indicate that the request should never timeout,
323
+ set it to `-1`.
324
+ :param timeout: The period to wait for a response. If no response is received
325
+ before the timeout expires, the request fails and returns an error. To indicate
326
+ that the request should never timeout, set it to `-1`.
327
+ """
328
+ __path_parts: t.Dict[str, str] = {}
329
+ __path = "/_slm/status"
330
+ __query: t.Dict[str, t.Any] = {}
331
+ if error_trace is not None:
332
+ __query["error_trace"] = error_trace
333
+ if filter_path is not None:
334
+ __query["filter_path"] = filter_path
335
+ if human is not None:
336
+ __query["human"] = human
337
+ if master_timeout is not None:
338
+ __query["master_timeout"] = master_timeout
339
+ if pretty is not None:
340
+ __query["pretty"] = pretty
341
+ if timeout is not None:
342
+ __query["timeout"] = timeout
343
+ __headers = {"accept": "application/json"}
344
+ return await self.perform_request( # type: ignore[return-value]
345
+ "GET",
346
+ __path,
347
+ params=__query,
348
+ headers=__headers,
349
+ endpoint_id="slm.get_status",
350
+ path_parts=__path_parts,
351
+ )
352
+
353
+ @_rewrite_parameters(
354
+ body_fields=("config", "name", "repository", "retention", "schedule"),
355
+ )
356
+ async def put_lifecycle(
357
+ self,
358
+ *,
359
+ policy_id: str,
360
+ config: t.Optional[t.Mapping[str, t.Any]] = None,
361
+ error_trace: t.Optional[bool] = None,
362
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
363
+ human: t.Optional[bool] = None,
364
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
365
+ name: t.Optional[str] = None,
366
+ pretty: t.Optional[bool] = None,
367
+ repository: t.Optional[str] = None,
368
+ retention: t.Optional[t.Mapping[str, t.Any]] = None,
369
+ schedule: t.Optional[str] = None,
370
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
371
+ body: t.Optional[t.Dict[str, t.Any]] = None,
372
+ ) -> ObjectApiResponse[t.Any]:
373
+ """
374
+ .. raw:: html
375
+
376
+ <p>Create or update a policy.
377
+ Create or update a snapshot lifecycle policy.
378
+ If the policy already exists, this request increments the policy version.
379
+ Only the latest version of a policy is stored.</p>
380
+
381
+
382
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-slm-put-lifecycle>`_
383
+
384
+ :param policy_id: The identifier for the snapshot lifecycle policy you want to
385
+ create or update.
386
+ :param config: Configuration for each snapshot created by the policy.
387
+ :param master_timeout: The period to wait for a connection to the master node.
388
+ If no response is received before the timeout expires, the request fails
389
+ and returns an error. To indicate that the request should never timeout,
390
+ set it to `-1`.
391
+ :param name: Name automatically assigned to each snapshot created by the policy.
392
+ Date math is supported. To prevent conflicting snapshot names, a UUID is
393
+ automatically appended to each snapshot name.
394
+ :param repository: Repository used to store snapshots created by this policy.
395
+ This repository must exist prior to the policy’s creation. You can create
396
+ a repository using the snapshot repository API.
397
+ :param retention: Retention rules used to retain and delete snapshots created
398
+ by the policy.
399
+ :param schedule: Periodic or absolute schedule at which the policy creates snapshots.
400
+ SLM applies schedule changes immediately.
401
+ :param timeout: The period to wait for a response. If no response is received
402
+ before the timeout expires, the request fails and returns an error. To indicate
403
+ that the request should never timeout, set it to `-1`.
404
+ """
405
+ if policy_id in SKIP_IN_PATH:
406
+ raise ValueError("Empty value passed for parameter 'policy_id'")
407
+ __path_parts: t.Dict[str, str] = {"policy_id": _quote(policy_id)}
408
+ __path = f'/_slm/policy/{__path_parts["policy_id"]}'
409
+ __query: t.Dict[str, t.Any] = {}
410
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
411
+ if error_trace is not None:
412
+ __query["error_trace"] = error_trace
413
+ if filter_path is not None:
414
+ __query["filter_path"] = filter_path
415
+ if human is not None:
416
+ __query["human"] = human
417
+ if master_timeout is not None:
418
+ __query["master_timeout"] = master_timeout
419
+ if pretty is not None:
420
+ __query["pretty"] = pretty
421
+ if timeout is not None:
422
+ __query["timeout"] = timeout
423
+ if not __body:
424
+ if config is not None:
425
+ __body["config"] = config
426
+ if name is not None:
427
+ __body["name"] = name
428
+ if repository is not None:
429
+ __body["repository"] = repository
430
+ if retention is not None:
431
+ __body["retention"] = retention
432
+ if schedule is not None:
433
+ __body["schedule"] = schedule
434
+ if not __body:
435
+ __body = None # type: ignore[assignment]
436
+ __headers = {"accept": "application/json"}
437
+ if __body is not None:
438
+ __headers["content-type"] = "application/json"
439
+ return await self.perform_request( # type: ignore[return-value]
440
+ "PUT",
441
+ __path,
442
+ params=__query,
443
+ headers=__headers,
444
+ body=__body,
445
+ endpoint_id="slm.put_lifecycle",
446
+ path_parts=__path_parts,
447
+ )
448
+
449
+ @_rewrite_parameters()
450
+ async def start(
451
+ self,
452
+ *,
453
+ error_trace: t.Optional[bool] = None,
454
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
455
+ human: t.Optional[bool] = None,
456
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
457
+ pretty: t.Optional[bool] = None,
458
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
459
+ ) -> ObjectApiResponse[t.Any]:
460
+ """
461
+ .. raw:: html
462
+
463
+ <p>Start snapshot lifecycle management.
464
+ Snapshot lifecycle management (SLM) starts automatically when a cluster is formed.
465
+ Manually starting SLM is necessary only if it has been stopped using the stop SLM API.</p>
466
+
467
+
468
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-slm-start>`_
469
+
470
+ :param master_timeout: The period to wait for a connection to the master node.
471
+ If no response is received before the timeout expires, the request fails
472
+ and returns an error. To indicate that the request should never timeout,
473
+ set it to `-1`.
474
+ :param timeout: The period to wait for a response. If no response is received
475
+ before the timeout expires, the request fails and returns an error. To indicate
476
+ that the request should never timeout, set it to `-1`.
477
+ """
478
+ __path_parts: t.Dict[str, str] = {}
479
+ __path = "/_slm/start"
480
+ __query: t.Dict[str, t.Any] = {}
481
+ if error_trace is not None:
482
+ __query["error_trace"] = error_trace
483
+ if filter_path is not None:
484
+ __query["filter_path"] = filter_path
485
+ if human is not None:
486
+ __query["human"] = human
487
+ if master_timeout is not None:
488
+ __query["master_timeout"] = master_timeout
489
+ if pretty is not None:
490
+ __query["pretty"] = pretty
491
+ if timeout is not None:
492
+ __query["timeout"] = timeout
493
+ __headers = {"accept": "application/json"}
494
+ return await self.perform_request( # type: ignore[return-value]
495
+ "POST",
496
+ __path,
497
+ params=__query,
498
+ headers=__headers,
499
+ endpoint_id="slm.start",
500
+ path_parts=__path_parts,
501
+ )
502
+
503
+ @_rewrite_parameters()
504
+ async def stop(
505
+ self,
506
+ *,
507
+ error_trace: t.Optional[bool] = None,
508
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
509
+ human: t.Optional[bool] = None,
510
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
511
+ pretty: t.Optional[bool] = None,
512
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
513
+ ) -> ObjectApiResponse[t.Any]:
514
+ """
515
+ .. raw:: html
516
+
517
+ <p>Stop snapshot lifecycle management.
518
+ Stop all snapshot lifecycle management (SLM) operations and the SLM plugin.
519
+ This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices.
520
+ Stopping SLM does not stop any snapshots that are in progress.
521
+ You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped.</p>
522
+ <p>The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped.
523
+ Use the get snapshot lifecycle management status API to see if SLM is running.</p>
524
+
525
+
526
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-slm-stop>`_
527
+
528
+ :param master_timeout: The period to wait for a connection to the master node.
529
+ If no response is received before the timeout expires, the request fails
530
+ and returns an error. To indicate that the request should never timeout,
531
+ set it to `-1`.
532
+ :param timeout: The period to wait for a response. If no response is received
533
+ before the timeout expires, the request fails and returns an error. To indicate
534
+ that the request should never timeout, set it to `-1`.
535
+ """
536
+ __path_parts: t.Dict[str, str] = {}
537
+ __path = "/_slm/stop"
538
+ __query: t.Dict[str, t.Any] = {}
539
+ if error_trace is not None:
540
+ __query["error_trace"] = error_trace
541
+ if filter_path is not None:
542
+ __query["filter_path"] = filter_path
543
+ if human is not None:
544
+ __query["human"] = human
545
+ if master_timeout is not None:
546
+ __query["master_timeout"] = master_timeout
547
+ if pretty is not None:
548
+ __query["pretty"] = pretty
549
+ if timeout is not None:
550
+ __query["timeout"] = timeout
551
+ __headers = {"accept": "application/json"}
552
+ return await self.perform_request( # type: ignore[return-value]
553
+ "POST",
554
+ __path,
555
+ params=__query,
556
+ headers=__headers,
557
+ endpoint_id="slm.stop",
558
+ path_parts=__path_parts,
559
+ )