Skip to content

Commit b969cc3

Browse files
Auto-generated API code
1 parent 4f96941 commit b969cc3

File tree

17 files changed

+1446
-101
lines changed

17 files changed

+1446
-101
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: 24 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,
@@ -4549,6 +4553,7 @@ async def refresh(
45494553
For data streams, the API runs the refresh operation on the stream’s backing indices.</p>
45504554
<p>By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds.
45514555
You can change this default interval with the <code>index.refresh_interval</code> setting.</p>
4556+
<p>In Elastic Cloud Serverless, the default refresh interval is 5 seconds across all indices.</p>
45524557
<p>Refresh requests are synchronous and do not return a response until the refresh operation completes.</p>
45534558
<p>Refreshes are resource-intensive.
45544559
To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.</p>
@@ -5414,7 +5419,9 @@ async def shrink(
54145419
path_parts=__path_parts,
54155420
)
54165421

5417-
@_rewrite_parameters()
5422+
@_rewrite_parameters(
5423+
body_name="index_template",
5424+
)
54185425
async def simulate_index_template(
54195426
self,
54205427
*,
@@ -5425,6 +5432,8 @@ async def simulate_index_template(
54255432
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
54265433
human: t.Optional[bool] = None,
54275434
include_defaults: t.Optional[bool] = None,
5435+
index_template: t.Optional[t.Mapping[str, t.Any]] = None,
5436+
body: t.Optional[t.Mapping[str, t.Any]] = None,
54285437
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
54295438
pretty: t.Optional[bool] = None,
54305439
) -> ObjectApiResponse[t.Any]:
@@ -5444,12 +5453,19 @@ async def simulate_index_template(
54445453
only be dry-run added if new or can also replace an existing one
54455454
:param include_defaults: If true, returns all relevant default configurations
54465455
for the index template.
5456+
:param index_template:
54475457
:param master_timeout: Period to wait for a connection to the master node. If
54485458
no response is received before the timeout expires, the request fails and
54495459
returns an error.
54505460
"""
54515461
if name in SKIP_IN_PATH:
54525462
raise ValueError("Empty value passed for parameter 'name'")
5463+
if index_template is None and body is None:
5464+
raise ValueError(
5465+
"Empty value passed for parameters 'index_template' and 'body', one of them should be set."
5466+
)
5467+
elif index_template is not None and body is not None:
5468+
raise ValueError("Cannot set both 'index_template' and 'body'")
54535469
__path_parts: t.Dict[str, str] = {"name": _quote(name)}
54545470
__path = f'/_index_template/_simulate_index/{__path_parts["name"]}'
54555471
__query: t.Dict[str, t.Any] = {}
@@ -5469,12 +5485,18 @@ async def simulate_index_template(
54695485
__query["master_timeout"] = master_timeout
54705486
if pretty is not None:
54715487
__query["pretty"] = pretty
5488+
__body = index_template if index_template is not None else body
5489+
if not __body:
5490+
__body = None
54725491
__headers = {"accept": "application/json"}
5492+
if __body is not None:
5493+
__headers["content-type"] = "application/json"
54735494
return await self.perform_request( # type: ignore[return-value]
54745495
"POST",
54755496
__path,
54765497
params=__query,
54775498
headers=__headers,
5499+
body=__body,
54785500
endpoint_id="indices.simulate_index_template",
54795501
path_parts=__path_parts,
54805502
)

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/logstash.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ async def put_pipeline(
141141
142142
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-logstash-put-pipeline>`_
143143
144-
:param id: An identifier for the pipeline.
144+
:param id: An identifier for the pipeline. Pipeline IDs must begin with a letter
145+
or underscore and contain only letters, underscores, dashes, hyphens and
146+
numbers.
145147
:param pipeline:
146148
"""
147149
if id in SKIP_IN_PATH:

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)