Skip to content

Commit 228f456

Browse files
Auto-generated API code
1 parent 44cbf67 commit 228f456

28 files changed

+3190
-814
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 41 additions & 179 deletions
Large diffs are not rendered by default.

elasticsearch/_async/client/cat.py

Lines changed: 667 additions & 31 deletions
Large diffs are not rendered by default.

elasticsearch/_async/client/cluster.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ async def allocation_explain(
5151
Get explanations for shard allocations in the cluster.
5252
For unassigned shards, it provides an explanation for why the shard is unassigned.
5353
For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node.
54-
This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.</p>
54+
This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.
55+
Refer to the linked documentation for examples of how to troubleshoot allocation issues using this API.</p>
5556
5657
5758
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-allocation-explain>`_
@@ -361,8 +362,8 @@ async def get_settings(
361362
"""
362363
.. raw:: html
363364
364-
<p>Get cluster-wide settings.
365-
By default, it returns only settings that have been explicitly defined.</p>
365+
<p>Get cluster-wide settings.</p>
366+
<p>By default, it returns only settings that have been explicitly defined.</p>
366367
367368
368369
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-get-settings>`_
@@ -870,9 +871,9 @@ async def put_settings(
870871
871872
:param flat_settings: Return settings in flat format (default: false)
872873
:param master_timeout: Explicit operation timeout for connection to master node
873-
:param persistent:
874+
:param persistent: The settings that persist after the cluster restarts.
874875
:param timeout: Explicit operation timeout
875-
:param transient:
876+
:param transient: The settings that do not persist after the cluster restarts.
876877
"""
877878
__path_parts: t.Dict[str, str] = {}
878879
__path = "/_cluster/settings"

elasticsearch/_async/client/esql.py

Lines changed: 104 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class EsqlClient(NamespacedClient):
3131
"columnar",
3232
"filter",
3333
"include_ccs_metadata",
34+
"keep_alive",
35+
"keep_on_completion",
3436
"locale",
3537
"params",
3638
"profile",
@@ -88,7 +90,9 @@ async def async_query(
8890
parameter, runs it, and returns the results.
8991
:param allow_partial_results: If `true`, partial results will be returned if
9092
there are shard failures, but the query can continue to execute on other
91-
clusters and shards.
93+
clusters and shards. If `false`, the query will fail if there are any failures.
94+
To override the default behavior, you can set the `esql.query.allow_partial_results`
95+
cluster setting to `false`.
9296
:param columnar: By default, ES|QL returns results as rows. For example, FROM
9397
returns each individual document as one row. For the JSON, YAML, CBOR and
9498
smile formats, ES|QL can return the results in a columnar fashion where one
@@ -151,10 +155,6 @@ async def async_query(
151155
__query["format"] = format
152156
if human is not None:
153157
__query["human"] = human
154-
if keep_alive is not None:
155-
__query["keep_alive"] = keep_alive
156-
if keep_on_completion is not None:
157-
__query["keep_on_completion"] = keep_on_completion
158158
if pretty is not None:
159159
__query["pretty"] = pretty
160160
if not __body:
@@ -166,6 +166,10 @@ async def async_query(
166166
__body["filter"] = filter
167167
if include_ccs_metadata is not None:
168168
__body["include_ccs_metadata"] = include_ccs_metadata
169+
if keep_alive is not None:
170+
__body["keep_alive"] = keep_alive
171+
if keep_on_completion is not None:
172+
__body["keep_on_completion"] = keep_on_completion
169173
if locale is not None:
170174
__body["locale"] = locale
171175
if params is not None:
@@ -248,6 +252,14 @@ async def async_query_get(
248252
drop_null_columns: t.Optional[bool] = None,
249253
error_trace: t.Optional[bool] = None,
250254
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
255+
format: t.Optional[
256+
t.Union[
257+
str,
258+
t.Literal[
259+
"arrow", "cbor", "csv", "json", "smile", "tsv", "txt", "yaml"
260+
],
261+
]
262+
] = None,
251263
human: t.Optional[bool] = None,
252264
keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
253265
pretty: t.Optional[bool] = None,
@@ -273,6 +285,7 @@ async def async_query_get(
273285
will be removed from the `columns` and `values` portion of the results. If
274286
`true`, the response will include an extra section under the name `all_columns`
275287
which has the name of all the columns.
288+
:param format: A short version of the Accept header, for example `json` or `yaml`.
276289
:param keep_alive: The period for which the query and its results are stored
277290
in the cluster. When this period expires, the query and its results are deleted,
278291
even if the query is still ongoing.
@@ -293,6 +306,8 @@ async def async_query_get(
293306
__query["error_trace"] = error_trace
294307
if filter_path is not None:
295308
__query["filter_path"] = filter_path
309+
if format is not None:
310+
__query["format"] = format
296311
if human is not None:
297312
__query["human"] = human
298313
if keep_alive is not None:
@@ -366,6 +381,87 @@ async def async_query_stop(
366381
path_parts=__path_parts,
367382
)
368383

384+
@_rewrite_parameters()
385+
@_stability_warning(Stability.EXPERIMENTAL)
386+
async def get_query(
387+
self,
388+
*,
389+
id: str,
390+
error_trace: t.Optional[bool] = None,
391+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
392+
human: t.Optional[bool] = None,
393+
pretty: t.Optional[bool] = None,
394+
) -> ObjectApiResponse[t.Any]:
395+
"""
396+
.. raw:: html
397+
398+
<p>Get a specific running ES|QL query information.
399+
Returns an object extended information about a running ES|QL query.</p>
400+
401+
402+
:param id: The query ID
403+
"""
404+
if id in SKIP_IN_PATH:
405+
raise ValueError("Empty value passed for parameter 'id'")
406+
__path_parts: t.Dict[str, str] = {"id": _quote(id)}
407+
__path = f'/_query/queries/{__path_parts["id"]}'
408+
__query: t.Dict[str, t.Any] = {}
409+
if error_trace is not None:
410+
__query["error_trace"] = error_trace
411+
if filter_path is not None:
412+
__query["filter_path"] = filter_path
413+
if human is not None:
414+
__query["human"] = human
415+
if pretty is not None:
416+
__query["pretty"] = pretty
417+
__headers = {"accept": "application/json"}
418+
return await self.perform_request( # type: ignore[return-value]
419+
"GET",
420+
__path,
421+
params=__query,
422+
headers=__headers,
423+
endpoint_id="esql.get_query",
424+
path_parts=__path_parts,
425+
)
426+
427+
@_rewrite_parameters()
428+
@_stability_warning(Stability.EXPERIMENTAL)
429+
async def list_queries(
430+
self,
431+
*,
432+
error_trace: t.Optional[bool] = None,
433+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
434+
human: t.Optional[bool] = None,
435+
pretty: t.Optional[bool] = None,
436+
) -> ObjectApiResponse[t.Any]:
437+
"""
438+
.. raw:: html
439+
440+
<p>Get running ES|QL queries information.
441+
Returns an object containing IDs and other information about the running ES|QL queries.</p>
442+
443+
"""
444+
__path_parts: t.Dict[str, str] = {}
445+
__path = "/_query/queries"
446+
__query: t.Dict[str, t.Any] = {}
447+
if error_trace is not None:
448+
__query["error_trace"] = error_trace
449+
if filter_path is not None:
450+
__query["filter_path"] = filter_path
451+
if human is not None:
452+
__query["human"] = human
453+
if pretty is not None:
454+
__query["pretty"] = pretty
455+
__headers = {"accept": "application/json"}
456+
return await self.perform_request( # type: ignore[return-value]
457+
"GET",
458+
__path,
459+
params=__query,
460+
headers=__headers,
461+
endpoint_id="esql.list_queries",
462+
path_parts=__path_parts,
463+
)
464+
369465
@_rewrite_parameters(
370466
body_fields=(
371467
"query",
@@ -422,7 +518,9 @@ async def query(
422518
parameter, runs it, and returns the results.
423519
:param allow_partial_results: If `true`, partial results will be returned if
424520
there are shard failures, but the query can continue to execute on other
425-
clusters and shards.
521+
clusters and shards. If `false`, the query will fail if there are any failures.
522+
To override the default behavior, you can set the `esql.query.allow_partial_results`
523+
cluster setting to `false`.
426524
:param columnar: By default, ES|QL returns results as rows. For example, FROM
427525
returns each individual document as one row. For the JSON, YAML, CBOR and
428526
smile formats, ES|QL can return the results in a columnar fashion where one

0 commit comments

Comments
 (0)