Skip to content

Commit 8896e5b

Browse files
authored
update APIs to main
1 parent 27f5887 commit 8896e5b

File tree

16 files changed

+166
-334
lines changed

16 files changed

+166
-334
lines changed

Diff for: elasticsearch/_async/client/__init__.py

+21-36
Original file line numberDiff line numberDiff line change
@@ -1766,18 +1766,7 @@ async def field_caps(
17661766
include_unmapped: t.Optional[bool] = None,
17671767
index_filter: t.Optional[t.Mapping[str, t.Any]] = None,
17681768
pretty: t.Optional[bool] = None,
1769-
runtime_mappings: t.Optional[
1770-
t.Mapping[
1771-
str,
1772-
t.Union[
1773-
t.Mapping[str, t.Any],
1774-
t.Union[
1775-
t.List[t.Mapping[str, t.Any]],
1776-
t.Tuple[t.Mapping[str, t.Any], ...],
1777-
],
1778-
],
1779-
]
1780-
] = None,
1769+
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
17811770
types: t.Optional[t.Union[t.List[str], t.Tuple[str, ...]]] = None,
17821771
) -> ObjectApiResponse[t.Any]:
17831772
"""
@@ -2075,7 +2064,13 @@ async def get_source(
20752064
*,
20762065
index: str,
20772066
id: str,
2067+
error_trace: t.Optional[bool] = None,
2068+
filter_path: t.Optional[
2069+
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
2070+
] = None,
2071+
human: t.Optional[bool] = None,
20782072
preference: t.Optional[str] = None,
2073+
pretty: t.Optional[bool] = None,
20792074
realtime: t.Optional[bool] = None,
20802075
refresh: t.Optional[bool] = None,
20812076
routing: t.Optional[str] = None,
@@ -2127,8 +2122,16 @@ async def get_source(
21272122
raise ValueError("Empty value passed for parameter 'id'")
21282123
__path = f"/{_quote(index)}/_source/{_quote(id)}"
21292124
__query: t.Dict[str, t.Any] = {}
2125+
if error_trace is not None:
2126+
__query["error_trace"] = error_trace
2127+
if filter_path is not None:
2128+
__query["filter_path"] = filter_path
2129+
if human is not None:
2130+
__query["human"] = human
21302131
if preference is not None:
21312132
__query["preference"] = preference
2133+
if pretty is not None:
2134+
__query["pretty"] = pretty
21322135
if realtime is not None:
21332136
__query["realtime"] = realtime
21342137
if refresh is not None:
@@ -3395,6 +3398,7 @@ async def search(
33953398
]
33963399
] = None,
33973400
explain: t.Optional[bool] = None,
3401+
ext: t.Optional[t.Mapping[str, t.Any]] = None,
33983402
fields: t.Optional[
33993403
t.Union[t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...]]
34003404
] = None,
@@ -3433,18 +3437,7 @@ async def search(
34333437
] = None,
34343438
rest_total_hits_as_int: t.Optional[bool] = None,
34353439
routing: t.Optional[str] = None,
3436-
runtime_mappings: t.Optional[
3437-
t.Mapping[
3438-
str,
3439-
t.Union[
3440-
t.Mapping[str, t.Any],
3441-
t.Union[
3442-
t.List[t.Mapping[str, t.Any]],
3443-
t.Tuple[t.Mapping[str, t.Any], ...],
3444-
],
3445-
],
3446-
]
3447-
] = None,
3440+
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
34483441
script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
34493442
scroll: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
34503443
search_after: t.Optional[
@@ -3528,6 +3521,7 @@ async def search(
35283521
that are open, closed or both.
35293522
:param explain: If true, returns detailed information about score computation
35303523
as part of a hit.
3524+
:param ext: Configuration of search extensions defined by Elasticsearch plugins.
35313525
:param fields: Array of wildcard (*) patterns. The request returns values for
35323526
field names matching these patterns in the hits.fields property of the response.
35333527
:param from_: Starting document offset. By default, you cannot page through more
@@ -3668,6 +3662,8 @@ async def search(
36683662
__query["expand_wildcards"] = expand_wildcards
36693663
if explain is not None:
36703664
__body["explain"] = explain
3665+
if ext is not None:
3666+
__body["ext"] = ext
36713667
if fields is not None:
36723668
__body["fields"] = fields
36733669
if filter_path is not None:
@@ -3805,18 +3801,7 @@ async def search_mvt(
38053801
human: t.Optional[bool] = None,
38063802
pretty: t.Optional[bool] = None,
38073803
query: t.Optional[t.Mapping[str, t.Any]] = None,
3808-
runtime_mappings: t.Optional[
3809-
t.Mapping[
3810-
str,
3811-
t.Union[
3812-
t.Mapping[str, t.Any],
3813-
t.Union[
3814-
t.List[t.Mapping[str, t.Any]],
3815-
t.Tuple[t.Mapping[str, t.Any], ...],
3816-
],
3817-
],
3818-
]
3819-
] = None,
3804+
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
38203805
size: t.Optional[int] = None,
38213806
sort: t.Optional[
38223807
t.Union[

Diff for: elasticsearch/_async/client/async_search.py

+5-12
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ async def submit(
199199
]
200200
] = None,
201201
explain: t.Optional[bool] = None,
202+
ext: t.Optional[t.Mapping[str, t.Any]] = None,
202203
fields: t.Optional[
203204
t.Union[t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...]]
204205
] = None,
@@ -239,18 +240,7 @@ async def submit(
239240
] = None,
240241
rest_total_hits_as_int: t.Optional[bool] = None,
241242
routing: t.Optional[str] = None,
242-
runtime_mappings: t.Optional[
243-
t.Mapping[
244-
str,
245-
t.Union[
246-
t.Mapping[str, t.Any],
247-
t.Union[
248-
t.List[t.Mapping[str, t.Any]],
249-
t.Tuple[t.Mapping[str, t.Any], ...],
250-
],
251-
],
252-
]
253-
] = None,
243+
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
254244
script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
255245
scroll: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
256246
search_after: t.Optional[
@@ -335,6 +325,7 @@ async def submit(
335325
that are open, closed or both.
336326
:param explain: If true, returns detailed information about score computation
337327
as part of a hit.
328+
:param ext: Configuration of search extensions defined by Elasticsearch plugins.
338329
:param fields: Array of wildcard (*) patterns. The request returns values for
339330
field names matching these patterns in the hits.fields property of the response.
340331
:param from_: Starting document offset. By default, you cannot page through more
@@ -474,6 +465,8 @@ async def submit(
474465
__query["expand_wildcards"] = expand_wildcards
475466
if explain is not None:
476467
__body["explain"] = explain
468+
if ext is not None:
469+
__body["ext"] = ext
477470
if fields is not None:
478471
__body["fields"] = fields
479472
if filter_path is not None:

Diff for: elasticsearch/_async/client/eql.py

+1-12
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,7 @@ async def search(
204204
keep_on_completion: t.Optional[bool] = None,
205205
pretty: t.Optional[bool] = None,
206206
result_position: t.Optional[t.Union["t.Literal['head', 'tail']", str]] = None,
207-
runtime_mappings: t.Optional[
208-
t.Mapping[
209-
str,
210-
t.Union[
211-
t.Mapping[str, t.Any],
212-
t.Union[
213-
t.List[t.Mapping[str, t.Any]],
214-
t.Tuple[t.Mapping[str, t.Any], ...],
215-
],
216-
],
217-
]
218-
] = None,
207+
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
219208
size: t.Optional[int] = None,
220209
tiebreaker_field: t.Optional[str] = None,
221210
timestamp_field: t.Optional[str] = None,

Diff for: elasticsearch/_async/client/fleet.py

+5-12
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ async def search(
280280
]
281281
] = None,
282282
explain: t.Optional[bool] = None,
283+
ext: t.Optional[t.Mapping[str, t.Any]] = None,
283284
fields: t.Optional[
284285
t.Union[t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...]]
285286
] = None,
@@ -317,18 +318,7 @@ async def search(
317318
] = None,
318319
rest_total_hits_as_int: t.Optional[bool] = None,
319320
routing: t.Optional[str] = None,
320-
runtime_mappings: t.Optional[
321-
t.Mapping[
322-
str,
323-
t.Union[
324-
t.Mapping[str, t.Any],
325-
t.Union[
326-
t.List[t.Mapping[str, t.Any]],
327-
t.Tuple[t.Mapping[str, t.Any], ...],
328-
],
329-
],
330-
]
331-
] = None,
321+
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
332322
script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
333323
scroll: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
334324
search_after: t.Optional[
@@ -407,6 +397,7 @@ async def search(
407397
:param expand_wildcards:
408398
:param explain: If true, returns detailed information about score computation
409399
as part of a hit.
400+
:param ext: Configuration of search extensions defined by Elasticsearch plugins.
410401
:param fields: Array of wildcard (*) patterns. The request returns values for
411402
field names matching these patterns in the hits.fields property of the response.
412403
:param from_: Starting document offset. By default, you cannot page through more
@@ -530,6 +521,8 @@ async def search(
530521
__query["expand_wildcards"] = expand_wildcards
531522
if explain is not None:
532523
__body["explain"] = explain
524+
if ext is not None:
525+
__body["ext"] = ext
533526
if fields is not None:
534527
__body["fields"] = fields
535528
if filter_path is not None:

Diff for: elasticsearch/_async/client/indices.py

+48-12
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,53 @@ async def disk_usage(
984984
"POST", __path, params=__query, headers=__headers
985985
)
986986

987+
@_rewrite_parameters(
988+
body_name="config",
989+
)
990+
async def downsample(
991+
self,
992+
*,
993+
index: str,
994+
target_index: str,
995+
config: t.Any,
996+
error_trace: t.Optional[bool] = None,
997+
filter_path: t.Optional[
998+
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
999+
] = None,
1000+
human: t.Optional[bool] = None,
1001+
pretty: t.Optional[bool] = None,
1002+
) -> ObjectApiResponse[t.Any]:
1003+
"""
1004+
Downsample an index
1005+
1006+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/xpack-rollup.html>`_
1007+
1008+
:param index: The index to downsample
1009+
:param target_index: The name of the target index to store downsampled data
1010+
:param config:
1011+
"""
1012+
if index in SKIP_IN_PATH:
1013+
raise ValueError("Empty value passed for parameter 'index'")
1014+
if target_index in SKIP_IN_PATH:
1015+
raise ValueError("Empty value passed for parameter 'target_index'")
1016+
if config is None:
1017+
raise ValueError("Empty value passed for parameter 'config'")
1018+
__path = f"/{_quote(index)}/_downsample/{_quote(target_index)}"
1019+
__query: t.Dict[str, t.Any] = {}
1020+
if error_trace is not None:
1021+
__query["error_trace"] = error_trace
1022+
if filter_path is not None:
1023+
__query["filter_path"] = filter_path
1024+
if human is not None:
1025+
__query["human"] = human
1026+
if pretty is not None:
1027+
__query["pretty"] = pretty
1028+
__body = config
1029+
__headers = {"accept": "application/json", "content-type": "application/json"}
1030+
return await self.perform_request( # type: ignore[return-value]
1031+
"POST", __path, params=__query, headers=__headers, body=__body
1032+
)
1033+
9871034
@_rewrite_parameters()
9881035
async def exists(
9891036
self,
@@ -2564,18 +2611,7 @@ async def put_mapping(
25642611
pretty: t.Optional[bool] = None,
25652612
properties: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
25662613
routing: t.Optional[t.Mapping[str, t.Any]] = None,
2567-
runtime: t.Optional[
2568-
t.Mapping[
2569-
str,
2570-
t.Union[
2571-
t.Mapping[str, t.Any],
2572-
t.Union[
2573-
t.List[t.Mapping[str, t.Any]],
2574-
t.Tuple[t.Mapping[str, t.Any], ...],
2575-
],
2576-
],
2577-
]
2578-
] = None,
2614+
runtime: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
25792615
source: t.Optional[t.Mapping[str, t.Any]] = None,
25802616
timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
25812617
write_index_only: t.Optional[bool] = None,

Diff for: elasticsearch/_async/client/ml.py

+2-24
Original file line numberDiff line numberDiff line change
@@ -2815,18 +2815,7 @@ async def put_datafeed(
28152815
pretty: t.Optional[bool] = None,
28162816
query: t.Optional[t.Mapping[str, t.Any]] = None,
28172817
query_delay: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
2818-
runtime_mappings: t.Optional[
2819-
t.Mapping[
2820-
str,
2821-
t.Union[
2822-
t.Mapping[str, t.Any],
2823-
t.Union[
2824-
t.List[t.Mapping[str, t.Any]],
2825-
t.Tuple[t.Mapping[str, t.Any], ...],
2826-
],
2827-
],
2828-
]
2829-
] = None,
2818+
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
28302819
script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
28312820
scroll_size: t.Optional[int] = None,
28322821
) -> ObjectApiResponse[t.Any]:
@@ -4023,18 +4012,7 @@ async def update_datafeed(
40234012
pretty: t.Optional[bool] = None,
40244013
query: t.Optional[t.Mapping[str, t.Any]] = None,
40254014
query_delay: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
4026-
runtime_mappings: t.Optional[
4027-
t.Mapping[
4028-
str,
4029-
t.Union[
4030-
t.Mapping[str, t.Any],
4031-
t.Union[
4032-
t.List[t.Mapping[str, t.Any]],
4033-
t.Tuple[t.Mapping[str, t.Any], ...],
4034-
],
4035-
],
4036-
]
4037-
] = None,
4015+
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
40384016
script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
40394017
scroll_size: t.Optional[int] = None,
40404018
) -> ObjectApiResponse[t.Any]:

Diff for: elasticsearch/_async/client/rollup.py

-47
Original file line numberDiff line numberDiff line change
@@ -291,53 +291,6 @@ async def put_job(
291291
"PUT", __path, params=__query, headers=__headers, body=__body
292292
)
293293

294-
@_rewrite_parameters(
295-
body_name="config",
296-
)
297-
async def rollup(
298-
self,
299-
*,
300-
index: str,
301-
rollup_index: str,
302-
config: t.Any,
303-
error_trace: t.Optional[bool] = None,
304-
filter_path: t.Optional[
305-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
306-
] = None,
307-
human: t.Optional[bool] = None,
308-
pretty: t.Optional[bool] = None,
309-
) -> ObjectApiResponse[t.Any]:
310-
"""
311-
Rollup an index
312-
313-
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/xpack-rollup.html>`_
314-
315-
:param index: The index to roll up
316-
:param rollup_index: The name of the rollup index to create
317-
:param config:
318-
"""
319-
if index in SKIP_IN_PATH:
320-
raise ValueError("Empty value passed for parameter 'index'")
321-
if rollup_index in SKIP_IN_PATH:
322-
raise ValueError("Empty value passed for parameter 'rollup_index'")
323-
if config is None:
324-
raise ValueError("Empty value passed for parameter 'config'")
325-
__path = f"/{_quote(index)}/_rollup/{_quote(rollup_index)}"
326-
__query: t.Dict[str, t.Any] = {}
327-
if error_trace is not None:
328-
__query["error_trace"] = error_trace
329-
if filter_path is not None:
330-
__query["filter_path"] = filter_path
331-
if human is not None:
332-
__query["human"] = human
333-
if pretty is not None:
334-
__query["pretty"] = pretty
335-
__body = config
336-
__headers = {"accept": "application/json", "content-type": "application/json"}
337-
return await self.perform_request( # type: ignore[return-value]
338-
"POST", __path, params=__query, headers=__headers, body=__body
339-
)
340-
341294
@_rewrite_parameters(
342295
body_fields=True,
343296
)

0 commit comments

Comments
 (0)