Skip to content

Commit ada8ef9

Browse files
Auto-generated code for 8.18 (#3027)
* Auto-generated API code * Added missing types --------- Co-authored-by: Miguel Grinberg <[email protected]>
1 parent ddbdfab commit ada8ef9

File tree

11 files changed

+408
-42
lines changed

11 files changed

+408
-42
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ async def bulk(
700700
<li>JavaScript: Check out <code>client.helpers.*</code></li>
701701
<li>.NET: Check out <code>BulkAllObservable</code></li>
702702
<li>PHP: Check out bulk indexing.</li>
703+
<li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
703704
</ul>
704705
<p><strong>Submitting bulk requests with cURL</strong></p>
705706
<p>If you're providing text file input to <code>curl</code>, you must use the <code>--data-binary</code> flag instead of plain <code>-d</code>.
@@ -1416,7 +1417,7 @@ async def delete(
14161417
)
14171418

14181419
@_rewrite_parameters(
1419-
body_fields=("max_docs", "query", "slice"),
1420+
body_fields=("max_docs", "query", "slice", "sort"),
14201421
parameter_aliases={"from": "from_"},
14211422
)
14221423
async def delete_by_query(
@@ -1460,7 +1461,12 @@ async def delete_by_query(
14601461
] = None,
14611462
slice: t.Optional[t.Mapping[str, t.Any]] = None,
14621463
slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
1463-
sort: t.Optional[t.Sequence[str]] = None,
1464+
sort: t.Optional[
1465+
t.Union[
1466+
t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
1467+
t.Union[str, t.Mapping[str, t.Any]],
1468+
]
1469+
] = None,
14641470
stats: t.Optional[t.Sequence[str]] = None,
14651471
terminate_after: t.Optional[int] = None,
14661472
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -1592,7 +1598,7 @@ async def delete_by_query(
15921598
:param slice: Slice the request manually using the provided slice ID and total
15931599
number of slices.
15941600
:param slices: The number of slices this task should be divided into.
1595-
:param sort: A comma-separated list of `<field>:<direction>` pairs.
1601+
:param sort: A sort object that specifies the order of deleted documents.
15961602
:param stats: The specific `tag` of the request for logging and statistical purposes.
15971603
:param terminate_after: The maximum number of documents to collect for each shard.
15981604
If a query reaches this limit, Elasticsearch terminates the query early.
@@ -1682,8 +1688,6 @@ async def delete_by_query(
16821688
__query["search_type"] = search_type
16831689
if slices is not None:
16841690
__query["slices"] = slices
1685-
if sort is not None:
1686-
__query["sort"] = sort
16871691
if stats is not None:
16881692
__query["stats"] = stats
16891693
if terminate_after is not None:
@@ -1703,6 +1707,8 @@ async def delete_by_query(
17031707
__body["query"] = query
17041708
if slice is not None:
17051709
__body["slice"] = slice
1710+
if sort is not None:
1711+
__body["sort"] = sort
17061712
__headers = {"accept": "application/json", "content-type": "application/json"}
17071713
return await self.perform_request( # type: ignore[return-value]
17081714
"POST",

elasticsearch/_async/client/cat.py

Lines changed: 124 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,34 @@ async def aliases(
4747
] = None,
4848
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4949
format: t.Optional[str] = None,
50-
h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
50+
h: t.Optional[
51+
t.Union[
52+
t.Sequence[
53+
t.Union[
54+
str,
55+
t.Literal[
56+
"alias",
57+
"filter",
58+
"index",
59+
"is_write_index",
60+
"routing.index",
61+
"routing.search",
62+
],
63+
]
64+
],
65+
t.Union[
66+
str,
67+
t.Literal[
68+
"alias",
69+
"filter",
70+
"index",
71+
"is_write_index",
72+
"routing.index",
73+
"routing.search",
74+
],
75+
],
76+
]
77+
] = None,
5178
help: t.Optional[bool] = None,
5279
human: t.Optional[bool] = None,
5380
local: t.Optional[bool] = None,
@@ -74,7 +101,8 @@ async def aliases(
74101
values, such as `open,hidden`.
75102
:param format: Specifies the format to return the columnar data in, can be set
76103
to `text`, `json`, `cbor`, `yaml`, or `smile`.
77-
:param h: List of columns to appear in the response. Supports simple wildcards.
104+
:param h: A comma-separated list of columns names to display. It supports simple
105+
wildcards.
78106
:param help: When set to `true` will output available columns. This option can't
79107
be combined with any other query string option.
80108
:param local: If `true`, the request computes the list of selected nodes from
@@ -137,7 +165,48 @@ async def allocation(
137165
error_trace: t.Optional[bool] = None,
138166
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
139167
format: t.Optional[str] = None,
140-
h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
168+
h: t.Optional[
169+
t.Union[
170+
t.Sequence[
171+
t.Union[
172+
str,
173+
t.Literal[
174+
"disk.avail",
175+
"disk.indices",
176+
"disk.indices.forecast",
177+
"disk.percent",
178+
"disk.total",
179+
"disk.used",
180+
"host",
181+
"ip",
182+
"node",
183+
"node.role",
184+
"shards",
185+
"shards.undesired",
186+
"write_load.forecast",
187+
],
188+
]
189+
],
190+
t.Union[
191+
str,
192+
t.Literal[
193+
"disk.avail",
194+
"disk.indices",
195+
"disk.indices.forecast",
196+
"disk.percent",
197+
"disk.total",
198+
"disk.used",
199+
"host",
200+
"ip",
201+
"node",
202+
"node.role",
203+
"shards",
204+
"shards.undesired",
205+
"write_load.forecast",
206+
],
207+
],
208+
]
209+
] = None,
141210
help: t.Optional[bool] = None,
142211
human: t.Optional[bool] = None,
143212
local: t.Optional[bool] = None,
@@ -161,7 +230,8 @@ async def allocation(
161230
:param bytes: The unit used to display byte values.
162231
:param format: Specifies the format to return the columnar data in, can be set
163232
to `text`, `json`, `cbor`, `yaml`, or `smile`.
164-
:param h: List of columns to appear in the response. Supports simple wildcards.
233+
:param h: A comma-separated list of columns names to display. It supports simple
234+
wildcards.
165235
:param help: When set to `true` will output available columns. This option can't
166236
be combined with any other query string option.
167237
:param local: If `true`, the request computes the list of selected nodes from
@@ -224,7 +294,36 @@ async def component_templates(
224294
error_trace: t.Optional[bool] = None,
225295
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
226296
format: t.Optional[str] = None,
227-
h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
297+
h: t.Optional[
298+
t.Union[
299+
t.Sequence[
300+
t.Union[
301+
str,
302+
t.Literal[
303+
"alias_count",
304+
"included_in",
305+
"mapping_count",
306+
"metadata_count",
307+
"name",
308+
"settings_count",
309+
"version",
310+
],
311+
]
312+
],
313+
t.Union[
314+
str,
315+
t.Literal[
316+
"alias_count",
317+
"included_in",
318+
"mapping_count",
319+
"metadata_count",
320+
"name",
321+
"settings_count",
322+
"version",
323+
],
324+
],
325+
]
326+
] = None,
228327
help: t.Optional[bool] = None,
229328
human: t.Optional[bool] = None,
230329
local: t.Optional[bool] = None,
@@ -249,7 +348,8 @@ async def component_templates(
249348
If it is omitted, all component templates are returned.
250349
:param format: Specifies the format to return the columnar data in, can be set
251350
to `text`, `json`, `cbor`, `yaml`, or `smile`.
252-
:param h: List of columns to appear in the response. Supports simple wildcards.
351+
:param h: A comma-separated list of columns names to display. It supports simple
352+
wildcards.
253353
:param help: When set to `true` will output available columns. This option can't
254354
be combined with any other query string option.
255355
:param local: If `true`, the request computes the list of selected nodes from
@@ -310,7 +410,12 @@ async def count(
310410
error_trace: t.Optional[bool] = None,
311411
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
312412
format: t.Optional[str] = None,
313-
h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
413+
h: t.Optional[
414+
t.Union[
415+
t.Sequence[t.Union[str, t.Literal["count", "epoch", "timestamp"]]],
416+
t.Union[str, t.Literal["count", "epoch", "timestamp"]],
417+
]
418+
] = None,
314419
help: t.Optional[bool] = None,
315420
human: t.Optional[bool] = None,
316421
pretty: t.Optional[bool] = None,
@@ -334,7 +439,8 @@ async def count(
334439
and indices, omit this parameter or use `*` or `_all`.
335440
:param format: Specifies the format to return the columnar data in, can be set
336441
to `text`, `json`, `cbor`, `yaml`, or `smile`.
337-
:param h: List of columns to appear in the response. Supports simple wildcards.
442+
:param h: A comma-separated list of columns names to display. It supports simple
443+
wildcards.
338444
:param help: When set to `true` will output available columns. This option can't
339445
be combined with any other query string option.
340446
:param s: List of columns that determine how the table should be sorted. Sorting
@@ -389,7 +495,14 @@ async def fielddata(
389495
error_trace: t.Optional[bool] = None,
390496
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
391497
format: t.Optional[str] = None,
392-
h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
498+
h: t.Optional[
499+
t.Union[
500+
t.Sequence[
501+
t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]]
502+
],
503+
t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]],
504+
]
505+
] = None,
393506
help: t.Optional[bool] = None,
394507
human: t.Optional[bool] = None,
395508
pretty: t.Optional[bool] = None,
@@ -412,7 +525,8 @@ async def fielddata(
412525
:param bytes: The unit used to display byte values.
413526
:param format: Specifies the format to return the columnar data in, can be set
414527
to `text`, `json`, `cbor`, `yaml`, or `smile`.
415-
:param h: List of columns to appear in the response. Supports simple wildcards.
528+
:param h: A comma-separated list of columns names to display. It supports simple
529+
wildcards.
416530
:param help: When set to `true` will output available columns. This option can't
417531
be combined with any other query string option.
418532
:param s: List of columns that determine how the table should be sorted. Sorting

elasticsearch/_async/client/esql.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from ._base import NamespacedClient
2323
from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
2424

25+
ESQLBase = str # not used in this release of the client
26+
2527

2628
class EsqlClient(NamespacedClient):
2729

@@ -44,7 +46,7 @@ class EsqlClient(NamespacedClient):
4446
async def async_query(
4547
self,
4648
*,
47-
query: t.Optional[str] = None,
49+
query: t.Optional[t.Union[str, "ESQLBase"]] = None,
4850
columnar: t.Optional[bool] = None,
4951
delimiter: t.Optional[str] = None,
5052
drop_null_columns: t.Optional[bool] = None,
@@ -153,7 +155,7 @@ async def async_query(
153155
__query["pretty"] = pretty
154156
if not __body:
155157
if query is not None:
156-
__body["query"] = query
158+
__body["query"] = str(query)
157159
if columnar is not None:
158160
__body["columnar"] = columnar
159161
if filter is not None:
@@ -391,7 +393,7 @@ async def async_query_stop(
391393
async def query(
392394
self,
393395
*,
394-
query: t.Optional[str] = None,
396+
query: t.Optional[t.Union[str, "ESQLBase"]] = None,
395397
columnar: t.Optional[bool] = None,
396398
delimiter: t.Optional[str] = None,
397399
drop_null_columns: t.Optional[bool] = None,
@@ -480,7 +482,7 @@ async def query(
480482
__query["pretty"] = pretty
481483
if not __body:
482484
if query is not None:
483-
__body["query"] = query
485+
__body["query"] = str(query)
484486
if columnar is not None:
485487
__body["columnar"] = columnar
486488
if filter is not None:

elasticsearch/_async/client/sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ async def query(
283283
keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
284284
keep_on_completion: t.Optional[bool] = None,
285285
page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
286-
params: t.Optional[t.Mapping[str, t.Any]] = None,
286+
params: t.Optional[t.Sequence[t.Any]] = None,
287287
pretty: t.Optional[bool] = None,
288288
query: t.Optional[str] = None,
289289
request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,

elasticsearch/_async/client/transform.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,66 @@ async def schedule_now_transform(
602602
path_parts=__path_parts,
603603
)
604604

605+
@_rewrite_parameters()
606+
async def set_upgrade_mode(
607+
self,
608+
*,
609+
enabled: t.Optional[bool] = None,
610+
error_trace: t.Optional[bool] = None,
611+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
612+
human: t.Optional[bool] = None,
613+
pretty: t.Optional[bool] = None,
614+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
615+
) -> ObjectApiResponse[t.Any]:
616+
"""
617+
.. raw:: html
618+
619+
<p>Set upgrade_mode for transform indices.
620+
Sets a cluster wide upgrade_mode setting that prepares transform
621+
indices for an upgrade.
622+
When upgrading your cluster, in some circumstances you must restart your
623+
nodes and reindex your transform indices. In those circumstances,
624+
there must be no transforms running. You can close the transforms,
625+
do the upgrade, then open all the transforms again. Alternatively,
626+
you can use this API to temporarily halt tasks associated with the transforms
627+
and prevent new transforms from opening. You can also use this API
628+
during upgrades that do not require you to reindex your transform
629+
indices, though stopping transforms is not a requirement in that case.
630+
You can see the current value for the upgrade_mode setting by using the get
631+
transform info API.</p>
632+
633+
634+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-transform-set-upgrade-mode>`_
635+
636+
:param enabled: When `true`, it enables `upgrade_mode` which temporarily halts
637+
all transform tasks and prohibits new transform tasks from starting.
638+
:param timeout: The time to wait for the request to be completed.
639+
"""
640+
__path_parts: t.Dict[str, str] = {}
641+
__path = "/_transform/set_upgrade_mode"
642+
__query: t.Dict[str, t.Any] = {}
643+
if enabled is not None:
644+
__query["enabled"] = enabled
645+
if error_trace is not None:
646+
__query["error_trace"] = error_trace
647+
if filter_path is not None:
648+
__query["filter_path"] = filter_path
649+
if human is not None:
650+
__query["human"] = human
651+
if pretty is not None:
652+
__query["pretty"] = pretty
653+
if timeout is not None:
654+
__query["timeout"] = timeout
655+
__headers = {"accept": "application/json"}
656+
return await self.perform_request( # type: ignore[return-value]
657+
"POST",
658+
__path,
659+
params=__query,
660+
headers=__headers,
661+
endpoint_id="transform.set_upgrade_mode",
662+
path_parts=__path_parts,
663+
)
664+
605665
@_rewrite_parameters(
606666
parameter_aliases={"from": "from_"},
607667
)

0 commit comments

Comments
 (0)