Skip to content

Commit 4c9294d

Browse files
Auto-generated API code
1 parent 44cbf67 commit 4c9294d

34 files changed

+3766
-1028
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 56 additions & 203 deletions
Large diffs are not rendered by default.

elasticsearch/_async/client/cat.py

Lines changed: 594 additions & 32 deletions
Large diffs are not rendered by default.

elasticsearch/_async/client/cluster.py

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,25 @@ async def allocation_explain(
4949
5050
<p>Explain the shard allocations.
5151
Get explanations for shard allocations in the cluster.
52+
This API accepts the current_node, index, primary and shard parameters in the request body or in query parameters, but not in both at the same time.
5253
For unassigned shards, it provides an explanation for why the shard is unassigned.
5354
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>
55+
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.
56+
Refer to the linked documentation for examples of how to troubleshoot allocation issues using this API.</p>
5557
5658
5759
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-allocation-explain>`_
5860
59-
:param current_node: Specifies the node ID or the name of the node to only explain
60-
a shard that is currently located on the specified node.
61+
:param current_node: Explain a shard only if it is currently located on the specified
62+
node name or node ID.
6163
:param include_disk_info: If true, returns information about disk usage and shard
6264
sizes.
6365
:param include_yes_decisions: If true, returns YES decisions in explanation.
64-
:param index: Specifies the name of the index that you would like an explanation
65-
for.
66+
:param index: The name of the index that you would like an explanation for.
6667
:param master_timeout: Period to wait for a connection to the master node.
67-
:param primary: If true, returns explanation for the primary shard for the given
68-
shard ID.
69-
:param shard: Specifies the ID of the shard that you would like an explanation
68+
:param primary: If true, returns an explanation for the primary shard for the
69+
specified shard ID.
70+
:param shard: An identifier for the shard that you would like an explanation
7071
for.
7172
"""
7273
__path_parts: t.Dict[str, str] = {}
@@ -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>`_
@@ -441,7 +447,7 @@ async def health(
441447
wait_for_no_relocating_shards: t.Optional[bool] = None,
442448
wait_for_nodes: t.Optional[t.Union[int, str]] = None,
443449
wait_for_status: t.Optional[
444-
t.Union[str, t.Literal["green", "red", "yellow"]]
450+
t.Union[str, t.Literal["green", "red", "unavailable", "unknown", "yellow"]]
445451
] = None,
446452
) -> ObjectApiResponse[t.Any]:
447453
"""
@@ -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/eql.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ async def search(
204204
allow_partial_search_results: t.Optional[bool] = None,
205205
allow_partial_sequence_results: t.Optional[bool] = None,
206206
case_sensitive: t.Optional[bool] = None,
207+
ccs_minimize_roundtrips: t.Optional[bool] = None,
207208
error_trace: t.Optional[bool] = None,
208209
event_category_field: t.Optional[str] = None,
209210
expand_wildcards: t.Optional[
@@ -250,7 +251,9 @@ async def search(
250251
251252
:param index: The name of the index to scope the operation
252253
:param query: EQL query you wish to run.
253-
:param allow_no_indices:
254+
:param allow_no_indices: Whether to ignore if a wildcard indices expression resolves
255+
into no concrete indices. (This includes `_all` string or when no indices
256+
have been specified)
254257
:param allow_partial_search_results: Allow query execution also in case of shard
255258
failures. If true, the query will keep running and will return results based
256259
on the available shards. For sequences, the behavior can be further refined
@@ -261,9 +264,12 @@ async def search(
261264
If false, the sequence query will return successfully, but will always have
262265
empty results.
263266
:param case_sensitive:
267+
:param ccs_minimize_roundtrips: Indicates whether network round-trips should
268+
be minimized as part of cross-cluster search requests execution
264269
:param event_category_field: Field containing the event classification, such
265270
as process, file, or network.
266-
:param expand_wildcards:
271+
:param expand_wildcards: Whether to expand wildcard expression to concrete indices
272+
that are open, closed or both.
267273
:param fetch_size: Maximum number of events to search at a time for sequence
268274
queries.
269275
:param fields: Array of wildcard (*) patterns. The response returns values for
@@ -298,6 +304,8 @@ async def search(
298304
__body: t.Dict[str, t.Any] = body if body is not None else {}
299305
if allow_no_indices is not None:
300306
__query["allow_no_indices"] = allow_no_indices
307+
if ccs_minimize_roundtrips is not None:
308+
__query["ccs_minimize_roundtrips"] = ccs_minimize_roundtrips
301309
if error_trace is not None:
302310
__query["error_trace"] = error_trace
303311
if expand_wildcards is not None:

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)