Skip to content

Commit 58f1b37

Browse files
Auto-generated API code
1 parent f290324 commit 58f1b37

File tree

12 files changed

+1388
-94
lines changed

12 files changed

+1388
-94
lines changed

elasticsearch/_async/client/cat.py

Lines changed: 480 additions & 24 deletions
Large diffs are not rendered by default.

elasticsearch/_async/client/indices.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,11 @@ async def create_from(
833833
if pretty is not None:
834834
__query["pretty"] = pretty
835835
__body = create_from if create_from is not None else body
836-
__headers = {"accept": "application/json", "content-type": "application/json"}
836+
if not __body:
837+
__body = None
838+
__headers = {"accept": "application/json"}
839+
if __body is not None:
840+
__headers["content-type"] = "application/json"
837841
return await self.perform_request( # type: ignore[return-value]
838842
"PUT",
839843
__path,
@@ -5414,7 +5418,9 @@ async def shrink(
54145418
path_parts=__path_parts,
54155419
)
54165420

5417-
@_rewrite_parameters()
5421+
@_rewrite_parameters(
5422+
body_name="index_template",
5423+
)
54185424
async def simulate_index_template(
54195425
self,
54205426
*,
@@ -5425,6 +5431,8 @@ async def simulate_index_template(
54255431
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
54265432
human: t.Optional[bool] = None,
54275433
include_defaults: t.Optional[bool] = None,
5434+
index_template: t.Optional[t.Mapping[str, t.Any]] = None,
5435+
body: t.Optional[t.Mapping[str, t.Any]] = None,
54285436
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
54295437
pretty: t.Optional[bool] = None,
54305438
) -> ObjectApiResponse[t.Any]:
@@ -5444,12 +5452,19 @@ async def simulate_index_template(
54445452
only be dry-run added if new or can also replace an existing one
54455453
:param include_defaults: If true, returns all relevant default configurations
54465454
for the index template.
5455+
:param index_template:
54475456
:param master_timeout: Period to wait for a connection to the master node. If
54485457
no response is received before the timeout expires, the request fails and
54495458
returns an error.
54505459
"""
54515460
if name in SKIP_IN_PATH:
54525461
raise ValueError("Empty value passed for parameter 'name'")
5462+
if index_template is None and body is None:
5463+
raise ValueError(
5464+
"Empty value passed for parameters 'index_template' and 'body', one of them should be set."
5465+
)
5466+
elif index_template is not None and body is not None:
5467+
raise ValueError("Cannot set both 'index_template' and 'body'")
54535468
__path_parts: t.Dict[str, str] = {"name": _quote(name)}
54545469
__path = f'/_index_template/_simulate_index/{__path_parts["name"]}'
54555470
__query: t.Dict[str, t.Any] = {}
@@ -5469,12 +5484,18 @@ async def simulate_index_template(
54695484
__query["master_timeout"] = master_timeout
54705485
if pretty is not None:
54715486
__query["pretty"] = pretty
5487+
__body = index_template if index_template is not None else body
5488+
if not __body:
5489+
__body = None
54725490
__headers = {"accept": "application/json"}
5491+
if __body is not None:
5492+
__headers["content-type"] = "application/json"
54735493
return await self.perform_request( # type: ignore[return-value]
54745494
"POST",
54755495
__path,
54765496
params=__query,
54775497
headers=__headers,
5498+
body=__body,
54785499
endpoint_id="indices.simulate_index_template",
54795500
path_parts=__path_parts,
54805501
)

elasticsearch/_async/client/inference.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2504,7 +2504,7 @@ async def sparse_embedding(
25042504
)
25052505

25062506
@_rewrite_parameters(
2507-
body_fields=("input", "task_settings"),
2507+
body_fields=("input", "input_type", "task_settings"),
25082508
)
25092509
async def text_embedding(
25102510
self,
@@ -2514,6 +2514,7 @@ async def text_embedding(
25142514
error_trace: t.Optional[bool] = None,
25152515
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
25162516
human: t.Optional[bool] = None,
2517+
input_type: t.Optional[str] = None,
25172518
pretty: t.Optional[bool] = None,
25182519
task_settings: t.Optional[t.Any] = None,
25192520
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -2529,6 +2530,13 @@ async def text_embedding(
25292530
25302531
:param inference_id: The inference Id
25312532
:param input: Inference input. Either a string or an array of strings.
2533+
:param input_type: The input data type for the text embedding model. Possible
2534+
values include: * `SEARCH` * `INGEST` * `CLASSIFICATION` * `CLUSTERING` Not
2535+
all services support all values. Unsupported values will trigger a validation
2536+
exception. Accepted values depend on the configured inference service, refer
2537+
to the relevant service-specific documentation for more info. > info > The
2538+
`input_type` parameter specified on the root level of the request body will
2539+
take precedence over the `input_type` parameter specified in `task_settings`.
25322540
:param task_settings: Optional task settings
25332541
:param timeout: Specifies the amount of time to wait for the inference request
25342542
to complete.
@@ -2554,6 +2562,8 @@ async def text_embedding(
25542562
if not __body:
25552563
if input is not None:
25562564
__body["input"] = input
2565+
if input_type is not None:
2566+
__body["input_type"] = input_type
25572567
if task_settings is not None:
25582568
__body["task_settings"] = task_settings
25592569
if not __body:

elasticsearch/_async/client/shutdown.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,9 @@ async def delete_node(
3333
error_trace: t.Optional[bool] = None,
3434
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3535
human: t.Optional[bool] = None,
36-
master_timeout: t.Optional[
37-
t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
38-
] = None,
36+
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3937
pretty: t.Optional[bool] = None,
40-
timeout: t.Optional[
41-
t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
42-
] = None,
38+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4339
) -> ObjectApiResponse[t.Any]:
4440
"""
4541
.. raw:: html
@@ -97,9 +93,7 @@ async def get_node(
9793
error_trace: t.Optional[bool] = None,
9894
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
9995
human: t.Optional[bool] = None,
100-
master_timeout: t.Optional[
101-
t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
102-
] = None,
96+
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
10397
pretty: t.Optional[bool] = None,
10498
) -> ObjectApiResponse[t.Any]:
10599
"""
@@ -162,14 +156,10 @@ async def put_node(
162156
error_trace: t.Optional[bool] = None,
163157
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
164158
human: t.Optional[bool] = None,
165-
master_timeout: t.Optional[
166-
t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
167-
] = None,
159+
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
168160
pretty: t.Optional[bool] = None,
169161
target_node_name: t.Optional[str] = None,
170-
timeout: t.Optional[
171-
t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
172-
] = None,
162+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
173163
body: t.Optional[t.Dict[str, t.Any]] = None,
174164
) -> ObjectApiResponse[t.Any]:
175165
"""
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
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+
class C:
19+
20+
@_rewrite_parameters()
21+
@_stability_warning(Stability.EXPERIMENTAL)
22+
async def logs_disable(
23+
self,
24+
*,
25+
error_trace: t.Optional[bool] = None,
26+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
27+
human: t.Optional[bool] = None,
28+
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
29+
pretty: t.Optional[bool] = None,
30+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
31+
) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]:
32+
"""
33+
.. raw:: html
34+
35+
<p>Disable logs stream.</p>
36+
<p>Turn off the logs stream feature for this cluster.</p>
37+
38+
39+
`<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
40+
41+
:param master_timeout: The period to wait for a connection to the master node.
42+
If no response is received before the timeout expires, the request fails
43+
and returns an error.
44+
:param timeout: The period to wait for a response. If no response is received
45+
before the timeout expires, the request fails and returns an error.
46+
"""
47+
__path_parts: t.Dict[str, str] = {}
48+
__path = "/_streams/logs/_disable"
49+
__query: t.Dict[str, t.Any] = {}
50+
if error_trace is not None:
51+
__query["error_trace"] = error_trace
52+
if filter_path is not None:
53+
__query["filter_path"] = filter_path
54+
if human is not None:
55+
__query["human"] = human
56+
if master_timeout is not None:
57+
__query["master_timeout"] = master_timeout
58+
if pretty is not None:
59+
__query["pretty"] = pretty
60+
if timeout is not None:
61+
__query["timeout"] = timeout
62+
__headers = {"accept": "application/json,text/plain"}
63+
return await self.perform_request( # type: ignore[return-value]
64+
"POST",
65+
__path,
66+
params=__query,
67+
headers=__headers,
68+
endpoint_id="streams.logs_disable",
69+
path_parts=__path_parts,
70+
)
71+
72+
@_rewrite_parameters()
73+
@_stability_warning(Stability.EXPERIMENTAL)
74+
async def logs_enable(
75+
self,
76+
*,
77+
error_trace: t.Optional[bool] = None,
78+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
79+
human: t.Optional[bool] = None,
80+
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
81+
pretty: t.Optional[bool] = None,
82+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
83+
) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]:
84+
"""
85+
.. raw:: html
86+
87+
<p>Enable logs stream.</p>
88+
<p>Turn on the logs stream feature for this cluster.</p>
89+
<p>NOTE: To protect existing data, this feature can be turned on only if the
90+
cluster does not have existing indices or data streams that match the pattern <code>logs|logs.*</code>.
91+
If those indices or data streams exist, a <code>409 - Conflict</code> response and error is returned.</p>
92+
93+
94+
`<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
95+
96+
:param master_timeout: The period to wait for a connection to the master node.
97+
If no response is received before the timeout expires, the request fails
98+
and returns an error.
99+
:param timeout: The period to wait for a response. If no response is received
100+
before the timeout expires, the request fails and returns an error.
101+
"""
102+
__path_parts: t.Dict[str, str] = {}
103+
__path = "/_streams/logs/_enable"
104+
__query: t.Dict[str, t.Any] = {}
105+
if error_trace is not None:
106+
__query["error_trace"] = error_trace
107+
if filter_path is not None:
108+
__query["filter_path"] = filter_path
109+
if human is not None:
110+
__query["human"] = human
111+
if master_timeout is not None:
112+
__query["master_timeout"] = master_timeout
113+
if pretty is not None:
114+
__query["pretty"] = pretty
115+
if timeout is not None:
116+
__query["timeout"] = timeout
117+
__headers = {"accept": "application/json,text/plain"}
118+
return await self.perform_request( # type: ignore[return-value]
119+
"POST",
120+
__path,
121+
params=__query,
122+
headers=__headers,
123+
endpoint_id="streams.logs_enable",
124+
path_parts=__path_parts,
125+
)
126+
127+
@_rewrite_parameters()
128+
@_stability_warning(Stability.EXPERIMENTAL)
129+
async def status(
130+
self,
131+
*,
132+
error_trace: t.Optional[bool] = None,
133+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
134+
human: t.Optional[bool] = None,
135+
master_timeout: t.Optional[
136+
t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
137+
] = None,
138+
pretty: t.Optional[bool] = None,
139+
) -> ObjectApiResponse[t.Any]:
140+
"""
141+
.. raw:: html
142+
143+
<p>Get the status of streams.</p>
144+
<p>Get the current status for all types of streams.</p>
145+
146+
147+
`<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
148+
149+
:param master_timeout: Period to wait for a connection to the master node. If
150+
no response is received before the timeout expires, the request fails and
151+
returns an error.
152+
"""
153+
__path_parts: t.Dict[str, str] = {}
154+
__path = "/_streams/status"
155+
__query: t.Dict[str, t.Any] = {}
156+
if error_trace is not None:
157+
__query["error_trace"] = error_trace
158+
if filter_path is not None:
159+
__query["filter_path"] = filter_path
160+
if human is not None:
161+
__query["human"] = human
162+
if master_timeout is not None:
163+
__query["master_timeout"] = master_timeout
164+
if pretty is not None:
165+
__query["pretty"] = pretty
166+
__headers = {"accept": "application/json"}
167+
return await self.perform_request( # type: ignore[return-value]
168+
"GET",
169+
__path,
170+
params=__query,
171+
headers=__headers,
172+
endpoint_id="streams.status",
173+
path_parts=__path_parts,
174+
)

elasticsearch/_async/client/watcher.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,7 @@ async def put_watch(
552552
__body["transform"] = transform
553553
if trigger is not None:
554554
__body["trigger"] = trigger
555-
if not __body:
556-
__body = None # type: ignore[assignment]
557-
__headers = {"accept": "application/json"}
558-
if __body is not None:
559-
__headers["content-type"] = "application/json"
555+
__headers = {"accept": "application/json", "content-type": "application/json"}
560556
return await self.perform_request( # type: ignore[return-value]
561557
"PUT",
562558
__path,

0 commit comments

Comments
 (0)