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,469 @@
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 SqlClient(NamespacedClient):
27
+
28
+ @_rewrite_parameters(
29
+ body_fields=("cursor",),
30
+ )
31
+ async def clear_cursor(
32
+ self,
33
+ *,
34
+ cursor: t.Optional[str] = None,
35
+ error_trace: t.Optional[bool] = None,
36
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
37
+ human: t.Optional[bool] = None,
38
+ pretty: t.Optional[bool] = None,
39
+ body: t.Optional[t.Dict[str, t.Any]] = None,
40
+ ) -> ObjectApiResponse[t.Any]:
41
+ """
42
+ .. raw:: html
43
+
44
+ <p>Clear an SQL search cursor.</p>
45
+
46
+
47
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-sql-clear-cursor>`_
48
+
49
+ :param cursor: Cursor to clear.
50
+ """
51
+ if cursor is None and body is None:
52
+ raise ValueError("Empty value passed for parameter 'cursor'")
53
+ __path_parts: t.Dict[str, str] = {}
54
+ __path = "/_sql/close"
55
+ __query: t.Dict[str, t.Any] = {}
56
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
57
+ if error_trace is not None:
58
+ __query["error_trace"] = error_trace
59
+ if filter_path is not None:
60
+ __query["filter_path"] = filter_path
61
+ if human is not None:
62
+ __query["human"] = human
63
+ if pretty is not None:
64
+ __query["pretty"] = pretty
65
+ if not __body:
66
+ if cursor is not None:
67
+ __body["cursor"] = cursor
68
+ __headers = {"accept": "application/json", "content-type": "application/json"}
69
+ return await self.perform_request( # type: ignore[return-value]
70
+ "POST",
71
+ __path,
72
+ params=__query,
73
+ headers=__headers,
74
+ body=__body,
75
+ endpoint_id="sql.clear_cursor",
76
+ path_parts=__path_parts,
77
+ )
78
+
79
+ @_rewrite_parameters()
80
+ async def delete_async(
81
+ self,
82
+ *,
83
+ id: str,
84
+ error_trace: t.Optional[bool] = None,
85
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
86
+ human: t.Optional[bool] = None,
87
+ pretty: t.Optional[bool] = None,
88
+ ) -> ObjectApiResponse[t.Any]:
89
+ """
90
+ .. raw:: html
91
+
92
+ <p>Delete an async SQL search.
93
+ Delete an async SQL search or a stored synchronous SQL search.
94
+ If the search is still running, the API cancels it.</p>
95
+ <p>If the Elasticsearch security features are enabled, only the following users can use this API to delete a search:</p>
96
+ <ul>
97
+ <li>Users with the <code>cancel_task</code> cluster privilege.</li>
98
+ <li>The user who first submitted the search.</li>
99
+ </ul>
100
+
101
+
102
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-sql-delete-async>`_
103
+
104
+ :param id: The identifier for the search.
105
+ """
106
+ if id in SKIP_IN_PATH:
107
+ raise ValueError("Empty value passed for parameter 'id'")
108
+ __path_parts: t.Dict[str, str] = {"id": _quote(id)}
109
+ __path = f'/_sql/async/delete/{__path_parts["id"]}'
110
+ __query: t.Dict[str, t.Any] = {}
111
+ if error_trace is not None:
112
+ __query["error_trace"] = error_trace
113
+ if filter_path is not None:
114
+ __query["filter_path"] = filter_path
115
+ if human is not None:
116
+ __query["human"] = human
117
+ if pretty is not None:
118
+ __query["pretty"] = pretty
119
+ __headers = {"accept": "application/json"}
120
+ return await self.perform_request( # type: ignore[return-value]
121
+ "DELETE",
122
+ __path,
123
+ params=__query,
124
+ headers=__headers,
125
+ endpoint_id="sql.delete_async",
126
+ path_parts=__path_parts,
127
+ )
128
+
129
+ @_rewrite_parameters()
130
+ async def get_async(
131
+ self,
132
+ *,
133
+ id: str,
134
+ delimiter: t.Optional[str] = None,
135
+ error_trace: t.Optional[bool] = None,
136
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
137
+ format: t.Optional[str] = None,
138
+ human: t.Optional[bool] = None,
139
+ keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
140
+ pretty: t.Optional[bool] = None,
141
+ wait_for_completion_timeout: t.Optional[
142
+ t.Union[str, t.Literal[-1], t.Literal[0]]
143
+ ] = None,
144
+ ) -> ObjectApiResponse[t.Any]:
145
+ """
146
+ .. raw:: html
147
+
148
+ <p>Get async SQL search results.
149
+ Get the current status and available results for an async SQL search or stored synchronous SQL search.</p>
150
+ <p>If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API.</p>
151
+
152
+
153
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-sql-get-async>`_
154
+
155
+ :param id: The identifier for the search.
156
+ :param delimiter: The separator for CSV results. The API supports this parameter
157
+ only for CSV responses.
158
+ :param format: The format for the response. You must specify a format using this
159
+ parameter or the `Accept` HTTP header. If you specify both, the API uses
160
+ this parameter.
161
+ :param keep_alive: The retention period for the search and its results. It defaults
162
+ to the `keep_alive` period for the original SQL search.
163
+ :param wait_for_completion_timeout: The period to wait for complete results.
164
+ It defaults to no timeout, meaning the request waits for complete search
165
+ results.
166
+ """
167
+ if id in SKIP_IN_PATH:
168
+ raise ValueError("Empty value passed for parameter 'id'")
169
+ __path_parts: t.Dict[str, str] = {"id": _quote(id)}
170
+ __path = f'/_sql/async/{__path_parts["id"]}'
171
+ __query: t.Dict[str, t.Any] = {}
172
+ if delimiter is not None:
173
+ __query["delimiter"] = delimiter
174
+ if error_trace is not None:
175
+ __query["error_trace"] = error_trace
176
+ if filter_path is not None:
177
+ __query["filter_path"] = filter_path
178
+ if format is not None:
179
+ __query["format"] = format
180
+ if human is not None:
181
+ __query["human"] = human
182
+ if keep_alive is not None:
183
+ __query["keep_alive"] = keep_alive
184
+ if pretty is not None:
185
+ __query["pretty"] = pretty
186
+ if wait_for_completion_timeout is not None:
187
+ __query["wait_for_completion_timeout"] = wait_for_completion_timeout
188
+ __headers = {"accept": "application/json"}
189
+ return await self.perform_request( # type: ignore[return-value]
190
+ "GET",
191
+ __path,
192
+ params=__query,
193
+ headers=__headers,
194
+ endpoint_id="sql.get_async",
195
+ path_parts=__path_parts,
196
+ )
197
+
198
+ @_rewrite_parameters()
199
+ async def get_async_status(
200
+ self,
201
+ *,
202
+ id: str,
203
+ error_trace: t.Optional[bool] = None,
204
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
205
+ human: t.Optional[bool] = None,
206
+ pretty: t.Optional[bool] = None,
207
+ ) -> ObjectApiResponse[t.Any]:
208
+ """
209
+ .. raw:: html
210
+
211
+ <p>Get the async SQL search status.
212
+ Get the current status of an async SQL search or a stored synchronous SQL search.</p>
213
+
214
+
215
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-sql-get-async-status>`_
216
+
217
+ :param id: The identifier for the search.
218
+ """
219
+ if id in SKIP_IN_PATH:
220
+ raise ValueError("Empty value passed for parameter 'id'")
221
+ __path_parts: t.Dict[str, str] = {"id": _quote(id)}
222
+ __path = f'/_sql/async/status/{__path_parts["id"]}'
223
+ __query: t.Dict[str, t.Any] = {}
224
+ if error_trace is not None:
225
+ __query["error_trace"] = error_trace
226
+ if filter_path is not None:
227
+ __query["filter_path"] = filter_path
228
+ if human is not None:
229
+ __query["human"] = human
230
+ if pretty is not None:
231
+ __query["pretty"] = pretty
232
+ __headers = {"accept": "application/json"}
233
+ return await self.perform_request( # type: ignore[return-value]
234
+ "GET",
235
+ __path,
236
+ params=__query,
237
+ headers=__headers,
238
+ endpoint_id="sql.get_async_status",
239
+ path_parts=__path_parts,
240
+ )
241
+
242
+ @_rewrite_parameters(
243
+ body_fields=(
244
+ "allow_partial_search_results",
245
+ "catalog",
246
+ "columnar",
247
+ "cursor",
248
+ "fetch_size",
249
+ "field_multi_value_leniency",
250
+ "filter",
251
+ "index_using_frozen",
252
+ "keep_alive",
253
+ "keep_on_completion",
254
+ "page_timeout",
255
+ "params",
256
+ "query",
257
+ "request_timeout",
258
+ "runtime_mappings",
259
+ "time_zone",
260
+ "wait_for_completion_timeout",
261
+ ),
262
+ ignore_deprecated_options={"params", "request_timeout"},
263
+ )
264
+ async def query(
265
+ self,
266
+ *,
267
+ allow_partial_search_results: t.Optional[bool] = None,
268
+ catalog: t.Optional[str] = None,
269
+ columnar: t.Optional[bool] = None,
270
+ cursor: t.Optional[str] = None,
271
+ error_trace: t.Optional[bool] = None,
272
+ fetch_size: t.Optional[int] = None,
273
+ field_multi_value_leniency: t.Optional[bool] = None,
274
+ filter: t.Optional[t.Mapping[str, t.Any]] = None,
275
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
276
+ format: t.Optional[
277
+ t.Union[
278
+ str, t.Literal["cbor", "csv", "json", "smile", "tsv", "txt", "yaml"]
279
+ ]
280
+ ] = None,
281
+ human: t.Optional[bool] = None,
282
+ index_using_frozen: t.Optional[bool] = None,
283
+ keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
284
+ keep_on_completion: t.Optional[bool] = None,
285
+ page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
286
+ params: t.Optional[t.Mapping[str, t.Any]] = None,
287
+ pretty: t.Optional[bool] = None,
288
+ query: t.Optional[str] = None,
289
+ request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
290
+ runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
291
+ time_zone: t.Optional[str] = None,
292
+ wait_for_completion_timeout: t.Optional[
293
+ t.Union[str, t.Literal[-1], t.Literal[0]]
294
+ ] = None,
295
+ body: t.Optional[t.Dict[str, t.Any]] = None,
296
+ ) -> ObjectApiResponse[t.Any]:
297
+ """
298
+ .. raw:: html
299
+
300
+ <p>Get SQL search results.
301
+ Run an SQL request.</p>
302
+
303
+
304
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-sql-query>`_
305
+
306
+ :param allow_partial_search_results: If `true`, the response has partial results
307
+ when there are shard request timeouts or shard failures. If `false`, the
308
+ API returns an error with no partial results.
309
+ :param catalog: The default catalog (cluster) for queries. If unspecified, the
310
+ queries execute on the data in the local cluster only.
311
+ :param columnar: If `true`, the results are in a columnar fashion: one row represents
312
+ all the values of a certain column from the current page of results. The
313
+ API supports this parameter only for CBOR, JSON, SMILE, and YAML responses.
314
+ :param cursor: The cursor used to retrieve a set of paginated results. If you
315
+ specify a cursor, the API only uses the `columnar` and `time_zone` request
316
+ body parameters. It ignores other request body parameters.
317
+ :param fetch_size: The maximum number of rows (or entries) to return in one response.
318
+ :param field_multi_value_leniency: If `false`, the API returns an exception when
319
+ encountering multiple values for a field. If `true`, the API is lenient and
320
+ returns the first value from the array with no guarantee of consistent results.
321
+ :param filter: The Elasticsearch query DSL for additional filtering.
322
+ :param format: The format for the response. You can also specify a format using
323
+ the `Accept` HTTP header. If you specify both this parameter and the `Accept`
324
+ HTTP header, this parameter takes precedence.
325
+ :param index_using_frozen: If `true`, the search can run on frozen indices.
326
+ :param keep_alive: The retention period for an async or saved synchronous search.
327
+ :param keep_on_completion: If `true`, Elasticsearch stores synchronous searches
328
+ if you also specify the `wait_for_completion_timeout` parameter. If `false`,
329
+ Elasticsearch only stores async searches that don't finish before the `wait_for_completion_timeout`.
330
+ :param page_timeout: The minimum retention period for the scroll cursor. After
331
+ this time period, a pagination request might fail because the scroll cursor
332
+ is no longer available. Subsequent scroll requests prolong the lifetime of
333
+ the scroll cursor by the duration of `page_timeout` in the scroll request.
334
+ :param params: The values for parameters in the query.
335
+ :param query: The SQL query to run.
336
+ :param request_timeout: The timeout before the request fails.
337
+ :param runtime_mappings: One or more runtime fields for the search request. These
338
+ fields take precedence over mapped fields with the same name.
339
+ :param time_zone: The ISO-8601 time zone ID for the search.
340
+ :param wait_for_completion_timeout: The period to wait for complete results.
341
+ It defaults to no timeout, meaning the request waits for complete search
342
+ results. If the search doesn't finish within this period, the search becomes
343
+ async. To save a synchronous search, you must specify this parameter and
344
+ the `keep_on_completion` parameter.
345
+ """
346
+ __path_parts: t.Dict[str, str] = {}
347
+ __path = "/_sql"
348
+ __query: t.Dict[str, t.Any] = {}
349
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
350
+ if error_trace is not None:
351
+ __query["error_trace"] = error_trace
352
+ if filter_path is not None:
353
+ __query["filter_path"] = filter_path
354
+ if format is not None:
355
+ __query["format"] = format
356
+ if human is not None:
357
+ __query["human"] = human
358
+ if pretty is not None:
359
+ __query["pretty"] = pretty
360
+ if not __body:
361
+ if allow_partial_search_results is not None:
362
+ __body["allow_partial_search_results"] = allow_partial_search_results
363
+ if catalog is not None:
364
+ __body["catalog"] = catalog
365
+ if columnar is not None:
366
+ __body["columnar"] = columnar
367
+ if cursor is not None:
368
+ __body["cursor"] = cursor
369
+ if fetch_size is not None:
370
+ __body["fetch_size"] = fetch_size
371
+ if field_multi_value_leniency is not None:
372
+ __body["field_multi_value_leniency"] = field_multi_value_leniency
373
+ if filter is not None:
374
+ __body["filter"] = filter
375
+ if index_using_frozen is not None:
376
+ __body["index_using_frozen"] = index_using_frozen
377
+ if keep_alive is not None:
378
+ __body["keep_alive"] = keep_alive
379
+ if keep_on_completion is not None:
380
+ __body["keep_on_completion"] = keep_on_completion
381
+ if page_timeout is not None:
382
+ __body["page_timeout"] = page_timeout
383
+ if params is not None:
384
+ __body["params"] = params
385
+ if query is not None:
386
+ __body["query"] = query
387
+ if request_timeout is not None:
388
+ __body["request_timeout"] = request_timeout
389
+ if runtime_mappings is not None:
390
+ __body["runtime_mappings"] = runtime_mappings
391
+ if time_zone is not None:
392
+ __body["time_zone"] = time_zone
393
+ if wait_for_completion_timeout is not None:
394
+ __body["wait_for_completion_timeout"] = wait_for_completion_timeout
395
+ __headers = {"accept": "application/json", "content-type": "application/json"}
396
+ return await self.perform_request( # type: ignore[return-value]
397
+ "POST",
398
+ __path,
399
+ params=__query,
400
+ headers=__headers,
401
+ body=__body,
402
+ endpoint_id="sql.query",
403
+ path_parts=__path_parts,
404
+ )
405
+
406
+ @_rewrite_parameters(
407
+ body_fields=("query", "fetch_size", "filter", "time_zone"),
408
+ )
409
+ async def translate(
410
+ self,
411
+ *,
412
+ query: t.Optional[str] = None,
413
+ error_trace: t.Optional[bool] = None,
414
+ fetch_size: t.Optional[int] = None,
415
+ filter: t.Optional[t.Mapping[str, t.Any]] = None,
416
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
417
+ human: t.Optional[bool] = None,
418
+ pretty: t.Optional[bool] = None,
419
+ time_zone: t.Optional[str] = None,
420
+ body: t.Optional[t.Dict[str, t.Any]] = None,
421
+ ) -> ObjectApiResponse[t.Any]:
422
+ """
423
+ .. raw:: html
424
+
425
+ <p>Translate SQL into Elasticsearch queries.
426
+ Translate an SQL search into a search API request containing Query DSL.
427
+ It accepts the same request body parameters as the SQL search API, excluding <code>cursor</code>.</p>
428
+
429
+
430
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-sql-translate>`_
431
+
432
+ :param query: The SQL query to run.
433
+ :param fetch_size: The maximum number of rows (or entries) to return in one response.
434
+ :param filter: The Elasticsearch query DSL for additional filtering.
435
+ :param time_zone: The ISO-8601 time zone ID for the search.
436
+ """
437
+ if query is None and body is None:
438
+ raise ValueError("Empty value passed for parameter 'query'")
439
+ __path_parts: t.Dict[str, str] = {}
440
+ __path = "/_sql/translate"
441
+ __query: t.Dict[str, t.Any] = {}
442
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
443
+ if error_trace is not None:
444
+ __query["error_trace"] = error_trace
445
+ if filter_path is not None:
446
+ __query["filter_path"] = filter_path
447
+ if human is not None:
448
+ __query["human"] = human
449
+ if pretty is not None:
450
+ __query["pretty"] = pretty
451
+ if not __body:
452
+ if query is not None:
453
+ __body["query"] = query
454
+ if fetch_size is not None:
455
+ __body["fetch_size"] = fetch_size
456
+ if filter is not None:
457
+ __body["filter"] = filter
458
+ if time_zone is not None:
459
+ __body["time_zone"] = time_zone
460
+ __headers = {"accept": "application/json", "content-type": "application/json"}
461
+ return await self.perform_request( # type: ignore[return-value]
462
+ "POST",
463
+ __path,
464
+ params=__query,
465
+ headers=__headers,
466
+ body=__body,
467
+ endpoint_id="sql.translate",
468
+ path_parts=__path_parts,
469
+ )
@@ -0,0 +1,76 @@
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 _rewrite_parameters
24
+
25
+
26
+ class SslClient(NamespacedClient):
27
+
28
+ @_rewrite_parameters()
29
+ async def certificates(
30
+ self,
31
+ *,
32
+ error_trace: t.Optional[bool] = None,
33
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
34
+ human: t.Optional[bool] = None,
35
+ pretty: t.Optional[bool] = None,
36
+ ) -> ObjectApiResponse[t.Any]:
37
+ """
38
+ .. raw:: html
39
+
40
+ <p>Get SSL certificates.</p>
41
+ <p>Get information about the X.509 certificates that are used to encrypt communications in the cluster.
42
+ The API returns a list that includes certificates from all TLS contexts including:</p>
43
+ <ul>
44
+ <li>Settings for transport and HTTP interfaces</li>
45
+ <li>TLS settings that are used within authentication realms</li>
46
+ <li>TLS settings for remote monitoring exporters</li>
47
+ </ul>
48
+ <p>The list includes certificates that are used for configuring trust, such as those configured in the <code>xpack.security.transport.ssl.truststore</code> and <code>xpack.security.transport.ssl.certificate_authorities</code> settings.
49
+ It also includes certificates that are used for configuring server identity, such as <code>xpack.security.http.ssl.keystore</code> and <code>xpack.security.http.ssl.certificate settings</code>.</p>
50
+ <p>The list does not include certificates that are sourced from the default SSL context of the Java Runtime Environment (JRE), even if those certificates are in use within Elasticsearch.</p>
51
+ <p>NOTE: When a PKCS#11 token is configured as the truststore of the JRE, the API returns all the certificates that are included in the PKCS#11 token irrespective of whether these are used in the Elasticsearch TLS configuration.</p>
52
+ <p>If Elasticsearch is configured to use a keystore or truststore, the API output includes all certificates in that store, even though some of the certificates might not be in active use within the cluster.</p>
53
+
54
+
55
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ssl-certificates>`_
56
+ """
57
+ __path_parts: t.Dict[str, str] = {}
58
+ __path = "/_ssl/certificates"
59
+ __query: t.Dict[str, t.Any] = {}
60
+ if error_trace is not None:
61
+ __query["error_trace"] = error_trace
62
+ if filter_path is not None:
63
+ __query["filter_path"] = filter_path
64
+ if human is not None:
65
+ __query["human"] = human
66
+ if pretty is not None:
67
+ __query["pretty"] = pretty
68
+ __headers = {"accept": "application/json"}
69
+ return await self.perform_request( # type: ignore[return-value]
70
+ "GET",
71
+ __path,
72
+ params=__query,
73
+ headers=__headers,
74
+ endpoint_id="ssl.certificates",
75
+ path_parts=__path_parts,
76
+ )