Skip to content

Commit e5b50ec

Browse files
Auto-generated code for main
ML * Added the ml.clear_trained_model_deployment_cache API
1 parent 7713169 commit e5b50ec

File tree

12 files changed

+102
-34
lines changed

12 files changed

+102
-34
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,7 +1735,6 @@ async def explain(
17351735
async def field_caps(
17361736
self,
17371737
*,
1738-
fields: t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]],
17391738
index: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]] = None,
17401739
allow_no_indices: t.Optional[bool] = None,
17411740
error_trace: t.Optional[bool] = None,
@@ -1757,6 +1756,9 @@ async def field_caps(
17571756
],
17581757
]
17591758
] = None,
1759+
fields: t.Optional[
1760+
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
1761+
] = None,
17601762
filter_path: t.Optional[
17611763
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
17621764
] = None,
@@ -1774,8 +1776,6 @@ async def field_caps(
17741776
17751777
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html>`_
17761778
1777-
:param fields: Comma-separated list of fields to retrieve capabilities for. Wildcard
1778-
(`*`) expressions are supported.
17791779
:param index: Comma-separated list of data streams, indices, and aliases used
17801780
to limit the request. Supports wildcards (*). To target all data streams
17811781
and indices, omit this parameter or use * or _all.
@@ -1788,6 +1788,8 @@ async def field_caps(
17881788
request can target data streams, this argument determines whether wildcard
17891789
expressions match hidden data streams. Supports comma-separated values, such
17901790
as `open,hidden`.
1791+
:param fields: List of fields to retrieve capabilities for. Wildcard (`*`) expressions
1792+
are supported.
17911793
:param filters: An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent
17921794
:param ignore_unavailable: If `true`, missing or closed indices are not included
17931795
in the response.
@@ -1801,22 +1803,20 @@ async def field_caps(
18011803
:param types: Only return results for fields that have one of the types in the
18021804
list
18031805
"""
1804-
if fields is None:
1805-
raise ValueError("Empty value passed for parameter 'fields'")
18061806
if index not in SKIP_IN_PATH:
18071807
__path = f"/{_quote(index)}/_field_caps"
18081808
else:
18091809
__path = "/_field_caps"
18101810
__query: t.Dict[str, t.Any] = {}
18111811
__body: t.Dict[str, t.Any] = {}
1812-
if fields is not None:
1813-
__query["fields"] = fields
18141812
if allow_no_indices is not None:
18151813
__query["allow_no_indices"] = allow_no_indices
18161814
if error_trace is not None:
18171815
__query["error_trace"] = error_trace
18181816
if expand_wildcards is not None:
18191817
__query["expand_wildcards"] = expand_wildcards
1818+
if fields is not None:
1819+
__body["fields"] = fields
18201820
if filter_path is not None:
18211821
__query["filter_path"] = filter_path
18221822
if filters is not None:
@@ -3442,8 +3442,8 @@ async def search(
34423442
scroll: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
34433443
search_after: t.Optional[
34443444
t.Union[
3445-
t.List[t.Union[None, float, int, str]],
3446-
t.Tuple[t.Union[None, float, int, str], ...],
3445+
t.List[t.Union[None, bool, float, int, str, t.Any]],
3446+
t.Tuple[t.Union[None, bool, float, int, str, t.Any], ...],
34473447
]
34483448
] = None,
34493449
search_type: t.Optional[

elasticsearch/_async/client/async_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ async def submit(
245245
scroll: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
246246
search_after: t.Optional[
247247
t.Union[
248-
t.List[t.Union[None, float, int, str]],
249-
t.Tuple[t.Union[None, float, int, str], ...],
248+
t.List[t.Union[None, bool, float, int, str, t.Any]],
249+
t.Tuple[t.Union[None, bool, float, int, str, t.Any], ...],
250250
]
251251
] = None,
252252
search_type: t.Optional[

elasticsearch/_async/client/fleet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ async def search(
323323
scroll: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
324324
search_after: t.Optional[
325325
t.Union[
326-
t.List[t.Union[None, float, int, str]],
327-
t.Tuple[t.Union[None, float, int, str], ...],
326+
t.List[t.Union[None, bool, float, int, str, t.Any]],
327+
t.Tuple[t.Union[None, bool, float, int, str, t.Any], ...],
328328
]
329329
] = None,
330330
search_type: t.Optional[

elasticsearch/_async/client/ml.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,40 @@
2424

2525

2626
class MlClient(NamespacedClient):
27+
@_rewrite_parameters()
28+
async def clear_trained_model_deployment_cache(
29+
self,
30+
*,
31+
model_id: t.Optional[str] = None,
32+
error_trace: t.Optional[bool] = None,
33+
filter_path: t.Optional[
34+
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
35+
] = None,
36+
human: t.Optional[bool] = None,
37+
pretty: t.Optional[bool] = None,
38+
) -> ObjectApiResponse[t.Any]:
39+
"""
40+
Clear the cached results from a trained model deployment
41+
42+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/clear-trained-model-deployment-cache.html>`_
43+
44+
:param model_id: The unique identifier of the trained model.
45+
"""
46+
__path = f"/_ml/trained_models/{_quote(model_id)}/deployment/cache/_clear"
47+
__query: t.Dict[str, t.Any] = {}
48+
if error_trace is not None:
49+
__query["error_trace"] = error_trace
50+
if filter_path is not None:
51+
__query["filter_path"] = filter_path
52+
if human is not None:
53+
__query["human"] = human
54+
if pretty is not None:
55+
__query["pretty"] = pretty
56+
__headers = {"accept": "application/json"}
57+
return await self.perform_request( # type: ignore[return-value]
58+
"POST", __path, params=__query, headers=__headers
59+
)
60+
2761
@_rewrite_parameters(
2862
body_fields=True,
2963
)

elasticsearch/_async/client/security.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,8 +2066,8 @@ async def query_api_keys(
20662066
query: t.Optional[t.Mapping[str, t.Any]] = None,
20672067
search_after: t.Optional[
20682068
t.Union[
2069-
t.List[t.Union[None, float, int, str]],
2070-
t.Tuple[t.Union[None, float, int, str], ...],
2069+
t.List[t.Union[None, bool, float, int, str, t.Any]],
2070+
t.Tuple[t.Union[None, bool, float, int, str, t.Any], ...],
20712071
]
20722072
] = None,
20732073
size: t.Optional[int] = None,

elasticsearch/_async/client/watcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ async def query_watches(
412412
query: t.Optional[t.Mapping[str, t.Any]] = None,
413413
search_after: t.Optional[
414414
t.Union[
415-
t.List[t.Union[None, float, int, str]],
416-
t.Tuple[t.Union[None, float, int, str], ...],
415+
t.List[t.Union[None, bool, float, int, str, t.Any]],
416+
t.Tuple[t.Union[None, bool, float, int, str, t.Any], ...],
417417
]
418418
] = None,
419419
size: t.Optional[int] = None,

elasticsearch/_sync/client/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,6 @@ def explain(
17331733
def field_caps(
17341734
self,
17351735
*,
1736-
fields: t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]],
17371736
index: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]] = None,
17381737
allow_no_indices: t.Optional[bool] = None,
17391738
error_trace: t.Optional[bool] = None,
@@ -1755,6 +1754,9 @@ def field_caps(
17551754
],
17561755
]
17571756
] = None,
1757+
fields: t.Optional[
1758+
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
1759+
] = None,
17581760
filter_path: t.Optional[
17591761
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
17601762
] = None,
@@ -1772,8 +1774,6 @@ def field_caps(
17721774
17731775
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html>`_
17741776
1775-
:param fields: Comma-separated list of fields to retrieve capabilities for. Wildcard
1776-
(`*`) expressions are supported.
17771777
:param index: Comma-separated list of data streams, indices, and aliases used
17781778
to limit the request. Supports wildcards (*). To target all data streams
17791779
and indices, omit this parameter or use * or _all.
@@ -1786,6 +1786,8 @@ def field_caps(
17861786
request can target data streams, this argument determines whether wildcard
17871787
expressions match hidden data streams. Supports comma-separated values, such
17881788
as `open,hidden`.
1789+
:param fields: List of fields to retrieve capabilities for. Wildcard (`*`) expressions
1790+
are supported.
17891791
:param filters: An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent
17901792
:param ignore_unavailable: If `true`, missing or closed indices are not included
17911793
in the response.
@@ -1799,22 +1801,20 @@ def field_caps(
17991801
:param types: Only return results for fields that have one of the types in the
18001802
list
18011803
"""
1802-
if fields is None:
1803-
raise ValueError("Empty value passed for parameter 'fields'")
18041804
if index not in SKIP_IN_PATH:
18051805
__path = f"/{_quote(index)}/_field_caps"
18061806
else:
18071807
__path = "/_field_caps"
18081808
__query: t.Dict[str, t.Any] = {}
18091809
__body: t.Dict[str, t.Any] = {}
1810-
if fields is not None:
1811-
__query["fields"] = fields
18121810
if allow_no_indices is not None:
18131811
__query["allow_no_indices"] = allow_no_indices
18141812
if error_trace is not None:
18151813
__query["error_trace"] = error_trace
18161814
if expand_wildcards is not None:
18171815
__query["expand_wildcards"] = expand_wildcards
1816+
if fields is not None:
1817+
__body["fields"] = fields
18181818
if filter_path is not None:
18191819
__query["filter_path"] = filter_path
18201820
if filters is not None:
@@ -3440,8 +3440,8 @@ def search(
34403440
scroll: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
34413441
search_after: t.Optional[
34423442
t.Union[
3443-
t.List[t.Union[None, float, int, str]],
3444-
t.Tuple[t.Union[None, float, int, str], ...],
3443+
t.List[t.Union[None, bool, float, int, str, t.Any]],
3444+
t.Tuple[t.Union[None, bool, float, int, str, t.Any], ...],
34453445
]
34463446
] = None,
34473447
search_type: t.Optional[

elasticsearch/_sync/client/async_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ def submit(
245245
scroll: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
246246
search_after: t.Optional[
247247
t.Union[
248-
t.List[t.Union[None, float, int, str]],
249-
t.Tuple[t.Union[None, float, int, str], ...],
248+
t.List[t.Union[None, bool, float, int, str, t.Any]],
249+
t.Tuple[t.Union[None, bool, float, int, str, t.Any], ...],
250250
]
251251
] = None,
252252
search_type: t.Optional[

elasticsearch/_sync/client/fleet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ def search(
323323
scroll: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
324324
search_after: t.Optional[
325325
t.Union[
326-
t.List[t.Union[None, float, int, str]],
327-
t.Tuple[t.Union[None, float, int, str], ...],
326+
t.List[t.Union[None, bool, float, int, str, t.Any]],
327+
t.Tuple[t.Union[None, bool, float, int, str, t.Any], ...],
328328
]
329329
] = None,
330330
search_type: t.Optional[

elasticsearch/_sync/client/ml.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,40 @@
2424

2525

2626
class MlClient(NamespacedClient):
27+
@_rewrite_parameters()
28+
def clear_trained_model_deployment_cache(
29+
self,
30+
*,
31+
model_id: t.Optional[str] = None,
32+
error_trace: t.Optional[bool] = None,
33+
filter_path: t.Optional[
34+
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
35+
] = None,
36+
human: t.Optional[bool] = None,
37+
pretty: t.Optional[bool] = None,
38+
) -> ObjectApiResponse[t.Any]:
39+
"""
40+
Clear the cached results from a trained model deployment
41+
42+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/clear-trained-model-deployment-cache.html>`_
43+
44+
:param model_id: The unique identifier of the trained model.
45+
"""
46+
__path = f"/_ml/trained_models/{_quote(model_id)}/deployment/cache/_clear"
47+
__query: t.Dict[str, t.Any] = {}
48+
if error_trace is not None:
49+
__query["error_trace"] = error_trace
50+
if filter_path is not None:
51+
__query["filter_path"] = filter_path
52+
if human is not None:
53+
__query["human"] = human
54+
if pretty is not None:
55+
__query["pretty"] = pretty
56+
__headers = {"accept": "application/json"}
57+
return self.perform_request( # type: ignore[return-value]
58+
"POST", __path, params=__query, headers=__headers
59+
)
60+
2761
@_rewrite_parameters(
2862
body_fields=True,
2963
)

0 commit comments

Comments
 (0)