Skip to content

Commit 27c0d70

Browse files
Auto-generated API code (#2450)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 74a531c commit 27c0d70

File tree

6 files changed

+256
-76
lines changed

6 files changed

+256
-76
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4641,8 +4641,9 @@ async def update_by_query(
46414641
body: t.Optional[t.Dict[str, t.Any]] = None,
46424642
) -> ObjectApiResponse[t.Any]:
46434643
"""
4644-
Performs an update on every document in the index without changing the source,
4645-
for example to pick up a mapping change.
4644+
Updates documents that match the specified query. If no query is specified, performs
4645+
an update on every document in the index without changing the source, for example
4646+
to pick up a mapping change.
46464647
46474648
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html>`_
46484649

elasticsearch/_async/client/indices.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3194,6 +3194,75 @@ async def reload_search_analyzers(
31943194
"POST", __path, params=__query, headers=__headers
31953195
)
31963196

3197+
@_rewrite_parameters()
3198+
async def resolve_cluster(
3199+
self,
3200+
*,
3201+
name: t.Union[str, t.Sequence[str]],
3202+
allow_no_indices: t.Optional[bool] = None,
3203+
error_trace: t.Optional[bool] = None,
3204+
expand_wildcards: t.Optional[
3205+
t.Union[
3206+
t.Sequence[
3207+
t.Union["t.Literal['all', 'closed', 'hidden', 'none', 'open']", str]
3208+
],
3209+
t.Union["t.Literal['all', 'closed', 'hidden', 'none', 'open']", str],
3210+
]
3211+
] = None,
3212+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3213+
human: t.Optional[bool] = None,
3214+
ignore_throttled: t.Optional[bool] = None,
3215+
ignore_unavailable: t.Optional[bool] = None,
3216+
pretty: t.Optional[bool] = None,
3217+
) -> ObjectApiResponse[t.Any]:
3218+
"""
3219+
Resolves the specified index expressions to return information about each cluster,
3220+
including the local cluster, if included.
3221+
3222+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-cluster-api.html>`_
3223+
3224+
:param name: Comma-separated name(s) or index pattern(s) of the indices, aliases,
3225+
and data streams to resolve. Resources on remote clusters can be specified
3226+
using the `<cluster>`:`<name>` syntax.
3227+
:param allow_no_indices: If false, the request returns an error if any wildcard
3228+
expression, index alias, or _all value targets only missing or closed indices.
3229+
This behavior applies even if the request targets other open indices. For
3230+
example, a request targeting foo*,bar* returns an error if an index starts
3231+
with foo but no index starts with bar.
3232+
:param expand_wildcards: Type of index that wildcard patterns can match. If the
3233+
request can target data streams, this argument determines whether wildcard
3234+
expressions match hidden data streams. Supports comma-separated values, such
3235+
as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`.
3236+
:param ignore_throttled: If true, concrete, expanded or aliased indices are ignored
3237+
when frozen. Defaults to false.
3238+
:param ignore_unavailable: If false, the request returns an error if it targets
3239+
a missing or closed index. Defaults to false.
3240+
"""
3241+
if name in SKIP_IN_PATH:
3242+
raise ValueError("Empty value passed for parameter 'name'")
3243+
__path = f"/_resolve/cluster/{_quote(name)}"
3244+
__query: t.Dict[str, t.Any] = {}
3245+
if allow_no_indices is not None:
3246+
__query["allow_no_indices"] = allow_no_indices
3247+
if error_trace is not None:
3248+
__query["error_trace"] = error_trace
3249+
if expand_wildcards is not None:
3250+
__query["expand_wildcards"] = expand_wildcards
3251+
if filter_path is not None:
3252+
__query["filter_path"] = filter_path
3253+
if human is not None:
3254+
__query["human"] = human
3255+
if ignore_throttled is not None:
3256+
__query["ignore_throttled"] = ignore_throttled
3257+
if ignore_unavailable is not None:
3258+
__query["ignore_unavailable"] = ignore_unavailable
3259+
if pretty is not None:
3260+
__query["pretty"] = pretty
3261+
__headers = {"accept": "application/json"}
3262+
return await self.perform_request( # type: ignore[return-value]
3263+
"GET", __path, params=__query, headers=__headers
3264+
)
3265+
31973266
@_rewrite_parameters()
31983267
async def resolve_index(
31993268
self,

elasticsearch/_async/client/inference.py

Lines changed: 56 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ class InferenceClient(NamespacedClient):
2929
async def delete_model(
3030
self,
3131
*,
32-
task_type: t.Union["t.Literal['sparse_embedding', 'text_embedding']", str],
33-
model_id: str,
32+
inference_id: str,
33+
task_type: t.Optional[
34+
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
35+
] = None,
3436
error_trace: t.Optional[bool] = None,
3537
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3638
human: t.Optional[bool] = None,
@@ -41,14 +43,17 @@ async def delete_model(
4143
4244
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html>`_
4345
44-
:param task_type: The model task type
45-
:param model_id: The unique identifier of the inference model.
46+
:param inference_id: The inference Id
47+
:param task_type: The task type
4648
"""
47-
if task_type in SKIP_IN_PATH:
48-
raise ValueError("Empty value passed for parameter 'task_type'")
49-
if model_id in SKIP_IN_PATH:
50-
raise ValueError("Empty value passed for parameter 'model_id'")
51-
__path = f"/_inference/{_quote(task_type)}/{_quote(model_id)}"
49+
if inference_id in SKIP_IN_PATH:
50+
raise ValueError("Empty value passed for parameter 'inference_id'")
51+
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
52+
__path = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}"
53+
elif inference_id not in SKIP_IN_PATH:
54+
__path = f"/_inference/{_quote(inference_id)}"
55+
else:
56+
raise ValueError("Couldn't find a path for the given parameters")
5257
__query: t.Dict[str, t.Any] = {}
5358
if error_trace is not None:
5459
__query["error_trace"] = error_trace
@@ -67,8 +72,10 @@ async def delete_model(
6772
async def get_model(
6873
self,
6974
*,
70-
task_type: t.Union["t.Literal['sparse_embedding', 'text_embedding']", str],
71-
model_id: str,
75+
inference_id: str,
76+
task_type: t.Optional[
77+
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
78+
] = None,
7279
error_trace: t.Optional[bool] = None,
7380
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
7481
human: t.Optional[bool] = None,
@@ -79,14 +86,17 @@ async def get_model(
7986
8087
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html>`_
8188
82-
:param task_type: The model task type
83-
:param model_id: The unique identifier of the inference model.
89+
:param inference_id: The inference Id
90+
:param task_type: The task type
8491
"""
85-
if task_type in SKIP_IN_PATH:
86-
raise ValueError("Empty value passed for parameter 'task_type'")
87-
if model_id in SKIP_IN_PATH:
88-
raise ValueError("Empty value passed for parameter 'model_id'")
89-
__path = f"/_inference/{_quote(task_type)}/{_quote(model_id)}"
92+
if inference_id in SKIP_IN_PATH:
93+
raise ValueError("Empty value passed for parameter 'inference_id'")
94+
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
95+
__path = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}"
96+
elif inference_id not in SKIP_IN_PATH:
97+
__path = f"/_inference/{_quote(inference_id)}"
98+
else:
99+
raise ValueError("Couldn't find a path for the given parameters")
90100
__query: t.Dict[str, t.Any] = {}
91101
if error_trace is not None:
92102
__query["error_trace"] = error_trace
@@ -107,9 +117,11 @@ async def get_model(
107117
async def inference(
108118
self,
109119
*,
110-
task_type: t.Union["t.Literal['sparse_embedding', 'text_embedding']", str],
111-
model_id: str,
120+
inference_id: str,
112121
input: t.Optional[t.Union[str, t.Sequence[str]]] = None,
122+
task_type: t.Optional[
123+
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
124+
] = None,
113125
error_trace: t.Optional[bool] = None,
114126
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
115127
human: t.Optional[bool] = None,
@@ -122,18 +134,21 @@ async def inference(
122134
123135
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html>`_
124136
125-
:param task_type: The model task type
126-
:param model_id: The unique identifier of the inference model.
137+
:param inference_id: The inference Id
127138
:param input: Text input to the model. Either a string or an array of strings.
139+
:param task_type: The task type
128140
:param task_settings: Optional task settings
129141
"""
130-
if task_type in SKIP_IN_PATH:
131-
raise ValueError("Empty value passed for parameter 'task_type'")
132-
if model_id in SKIP_IN_PATH:
133-
raise ValueError("Empty value passed for parameter 'model_id'")
142+
if inference_id in SKIP_IN_PATH:
143+
raise ValueError("Empty value passed for parameter 'inference_id'")
134144
if input is None and body is None:
135145
raise ValueError("Empty value passed for parameter 'input'")
136-
__path = f"/_inference/{_quote(task_type)}/{_quote(model_id)}"
146+
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
147+
__path = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}"
148+
elif inference_id not in SKIP_IN_PATH:
149+
__path = f"/_inference/{_quote(inference_id)}"
150+
else:
151+
raise ValueError("Couldn't find a path for the given parameters")
137152
__query: t.Dict[str, t.Any] = {}
138153
__body: t.Dict[str, t.Any] = body if body is not None else {}
139154
if error_trace is not None:
@@ -164,8 +179,10 @@ async def inference(
164179
async def put_model(
165180
self,
166181
*,
167-
task_type: t.Union["t.Literal['sparse_embedding', 'text_embedding']", str],
168-
model_id: str,
182+
inference_id: str,
183+
task_type: t.Optional[
184+
t.Union["t.Literal['sparse_embedding', 'text_embedding']", str]
185+
] = None,
169186
error_trace: t.Optional[bool] = None,
170187
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
171188
human: t.Optional[bool] = None,
@@ -178,21 +195,24 @@ async def put_model(
178195
179196
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html>`_
180197
181-
:param task_type: The model task type
182-
:param model_id: The unique identifier of the inference model.
198+
:param inference_id: The inference Id
199+
:param task_type: The task type
183200
:param model_config:
184201
"""
185-
if task_type in SKIP_IN_PATH:
186-
raise ValueError("Empty value passed for parameter 'task_type'")
187-
if model_id in SKIP_IN_PATH:
188-
raise ValueError("Empty value passed for parameter 'model_id'")
202+
if inference_id in SKIP_IN_PATH:
203+
raise ValueError("Empty value passed for parameter 'inference_id'")
189204
if model_config is None and body is None:
190205
raise ValueError(
191206
"Empty value passed for parameters 'model_config' and 'body', one of them should be set."
192207
)
193208
elif model_config is not None and body is not None:
194209
raise ValueError("Cannot set both 'model_config' and 'body'")
195-
__path = f"/_inference/{_quote(task_type)}/{_quote(model_id)}"
210+
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
211+
__path = f"/_inference/{_quote(task_type)}/{_quote(inference_id)}"
212+
elif inference_id not in SKIP_IN_PATH:
213+
__path = f"/_inference/{_quote(inference_id)}"
214+
else:
215+
raise ValueError("Couldn't find a path for the given parameters")
196216
__query: t.Dict[str, t.Any] = {}
197217
if error_trace is not None:
198218
__query["error_trace"] = error_trace

elasticsearch/_sync/client/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4639,8 +4639,9 @@ def update_by_query(
46394639
body: t.Optional[t.Dict[str, t.Any]] = None,
46404640
) -> ObjectApiResponse[t.Any]:
46414641
"""
4642-
Performs an update on every document in the index without changing the source,
4643-
for example to pick up a mapping change.
4642+
Updates documents that match the specified query. If no query is specified, performs
4643+
an update on every document in the index without changing the source, for example
4644+
to pick up a mapping change.
46444645
46454646
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html>`_
46464647

elasticsearch/_sync/client/indices.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3194,6 +3194,75 @@ def reload_search_analyzers(
31943194
"POST", __path, params=__query, headers=__headers
31953195
)
31963196

3197+
@_rewrite_parameters()
3198+
def resolve_cluster(
3199+
self,
3200+
*,
3201+
name: t.Union[str, t.Sequence[str]],
3202+
allow_no_indices: t.Optional[bool] = None,
3203+
error_trace: t.Optional[bool] = None,
3204+
expand_wildcards: t.Optional[
3205+
t.Union[
3206+
t.Sequence[
3207+
t.Union["t.Literal['all', 'closed', 'hidden', 'none', 'open']", str]
3208+
],
3209+
t.Union["t.Literal['all', 'closed', 'hidden', 'none', 'open']", str],
3210+
]
3211+
] = None,
3212+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3213+
human: t.Optional[bool] = None,
3214+
ignore_throttled: t.Optional[bool] = None,
3215+
ignore_unavailable: t.Optional[bool] = None,
3216+
pretty: t.Optional[bool] = None,
3217+
) -> ObjectApiResponse[t.Any]:
3218+
"""
3219+
Resolves the specified index expressions to return information about each cluster,
3220+
including the local cluster, if included.
3221+
3222+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-cluster-api.html>`_
3223+
3224+
:param name: Comma-separated name(s) or index pattern(s) of the indices, aliases,
3225+
and data streams to resolve. Resources on remote clusters can be specified
3226+
using the `<cluster>`:`<name>` syntax.
3227+
:param allow_no_indices: If false, the request returns an error if any wildcard
3228+
expression, index alias, or _all value targets only missing or closed indices.
3229+
This behavior applies even if the request targets other open indices. For
3230+
example, a request targeting foo*,bar* returns an error if an index starts
3231+
with foo but no index starts with bar.
3232+
:param expand_wildcards: Type of index that wildcard patterns can match. If the
3233+
request can target data streams, this argument determines whether wildcard
3234+
expressions match hidden data streams. Supports comma-separated values, such
3235+
as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`.
3236+
:param ignore_throttled: If true, concrete, expanded or aliased indices are ignored
3237+
when frozen. Defaults to false.
3238+
:param ignore_unavailable: If false, the request returns an error if it targets
3239+
a missing or closed index. Defaults to false.
3240+
"""
3241+
if name in SKIP_IN_PATH:
3242+
raise ValueError("Empty value passed for parameter 'name'")
3243+
__path = f"/_resolve/cluster/{_quote(name)}"
3244+
__query: t.Dict[str, t.Any] = {}
3245+
if allow_no_indices is not None:
3246+
__query["allow_no_indices"] = allow_no_indices
3247+
if error_trace is not None:
3248+
__query["error_trace"] = error_trace
3249+
if expand_wildcards is not None:
3250+
__query["expand_wildcards"] = expand_wildcards
3251+
if filter_path is not None:
3252+
__query["filter_path"] = filter_path
3253+
if human is not None:
3254+
__query["human"] = human
3255+
if ignore_throttled is not None:
3256+
__query["ignore_throttled"] = ignore_throttled
3257+
if ignore_unavailable is not None:
3258+
__query["ignore_unavailable"] = ignore_unavailable
3259+
if pretty is not None:
3260+
__query["pretty"] = pretty
3261+
__headers = {"accept": "application/json"}
3262+
return self.perform_request( # type: ignore[return-value]
3263+
"GET", __path, params=__query, headers=__headers
3264+
)
3265+
31973266
@_rewrite_parameters()
31983267
def resolve_index(
31993268
self,

0 commit comments

Comments
 (0)