Skip to content

Commit 985bbb5

Browse files
Auto-generated API code
1 parent 44cbf67 commit 985bbb5

32 files changed

+3562
-884
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 56 additions & 184 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: 17 additions & 6 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>`_
@@ -290,6 +291,7 @@ async def get_component_template(
290291
local: t.Optional[bool] = None,
291292
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
292293
pretty: t.Optional[bool] = None,
294+
settings_filter: t.Optional[t.Union[str, t.Sequence[str]]] = None,
293295
) -> ObjectApiResponse[t.Any]:
294296
"""
295297
.. raw:: html
@@ -310,6 +312,8 @@ async def get_component_template(
310312
:param master_timeout: Period to wait for a connection to the master node. If
311313
no response is received before the timeout expires, the request fails and
312314
returns an error.
315+
:param settings_filter: Filter out results, for example to filter out sensitive
316+
information. Supports wildcards or full settings keys
313317
"""
314318
__path_parts: t.Dict[str, str]
315319
if name not in SKIP_IN_PATH:
@@ -335,6 +339,8 @@ async def get_component_template(
335339
__query["master_timeout"] = master_timeout
336340
if pretty is not None:
337341
__query["pretty"] = pretty
342+
if settings_filter is not None:
343+
__query["settings_filter"] = settings_filter
338344
__headers = {"accept": "application/json"}
339345
return await self.perform_request( # type: ignore[return-value]
340346
"GET",
@@ -361,8 +367,8 @@ async def get_settings(
361367
"""
362368
.. raw:: html
363369
364-
<p>Get cluster-wide settings.
365-
By default, it returns only settings that have been explicitly defined.</p>
370+
<p>Get cluster-wide settings.</p>
371+
<p>By default, it returns only settings that have been explicitly defined.</p>
366372
367373
368374
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-get-settings>`_
@@ -731,6 +737,7 @@ async def put_component_template(
731737
*,
732738
name: str,
733739
template: t.Optional[t.Mapping[str, t.Any]] = None,
740+
cause: t.Optional[str] = None,
734741
create: t.Optional[bool] = None,
735742
deprecated: t.Optional[bool] = None,
736743
error_trace: t.Optional[bool] = None,
@@ -774,6 +781,7 @@ async def put_component_template(
774781
update settings API.
775782
:param template: The template to be applied which includes mappings, settings,
776783
or aliases configuration.
784+
:param cause: User defined reason for create the component template.
777785
:param create: If `true`, this request cannot replace or update existing component
778786
templates.
779787
:param deprecated: Marks this index template as deprecated. When creating or
@@ -798,6 +806,8 @@ async def put_component_template(
798806
__path = f'/_component_template/{__path_parts["name"]}'
799807
__query: t.Dict[str, t.Any] = {}
800808
__body: t.Dict[str, t.Any] = body if body is not None else {}
809+
if cause is not None:
810+
__query["cause"] = cause
801811
if create is not None:
802812
__query["create"] = create
803813
if error_trace is not None:
@@ -870,9 +880,9 @@ async def put_settings(
870880
871881
:param flat_settings: Return settings in flat format (default: false)
872882
:param master_timeout: Explicit operation timeout for connection to master node
873-
:param persistent:
883+
:param persistent: The settings that persist after the cluster restarts.
874884
:param timeout: Explicit operation timeout
875-
:param transient:
885+
:param transient: The settings that do not persist after the cluster restarts.
876886
"""
877887
__path_parts: t.Dict[str, str] = {}
878888
__path = "/_cluster/settings"
@@ -1109,7 +1119,8 @@ async def state(
11091119
when unavailable (missing or closed)
11101120
:param local: Return local information, do not retrieve the state from master
11111121
node (default: false)
1112-
:param master_timeout: Specify timeout for connection to master
1122+
:param master_timeout: Timeout for waiting for new cluster state in case it is
1123+
blocked
11131124
:param wait_for_metadata_version: Wait for the metadata version to be equal or
11141125
greater than the specified metadata version
11151126
:param wait_for_timeout: The maximum time to wait for wait_for_metadata_version

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)