Skip to content

Commit dec7e3c

Browse files
using fixed generator
1 parent 03189e0 commit dec7e3c

27 files changed

+418
-591
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -845,11 +845,7 @@ async def close_point_in_time(
845845
if not __body:
846846
if id is not None:
847847
__body["id"] = id
848-
if not __body:
849-
__body = None # type: ignore[assignment]
850-
__headers = {"accept": "application/json"}
851-
if __body is not None:
852-
__headers["content-type"] = "application/json"
848+
__headers = {"accept": "application/json", "content-type": "application/json"}
853849
return await self.perform_request( # type: ignore[return-value]
854850
"DELETE",
855851
__path,
@@ -923,8 +919,8 @@ async def count(
923919
This parameter can be used only when the `q` query string parameter is specified.
924920
:param analyzer: The analyzer to use for the query string. This parameter can
925921
be used only when the `q` query string parameter is specified.
926-
:param default_operator: The default operator for query string query: `AND` or
927-
`OR`. This parameter can be used only when the `q` query string parameter
922+
:param default_operator: The default operator for query string query: `and` or
923+
`or`. This parameter can be used only when the `q` query string parameter
928924
is specified.
929925
:param df: The field to use as a default when no field prefix is given in the
930926
query string. This parameter can be used only when the `q` query string parameter
@@ -1051,7 +1047,7 @@ async def create(
10511047
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
10521048
version: t.Optional[int] = None,
10531049
version_type: t.Optional[
1054-
t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1050+
t.Union[str, t.Literal["external", "external_gte", "internal"]]
10551051
] = None,
10561052
wait_for_active_shards: t.Optional[
10571053
t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -1230,7 +1226,7 @@ async def delete(
12301226
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
12311227
version: t.Optional[int] = None,
12321228
version_type: t.Optional[
1233-
t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1229+
t.Union[str, t.Literal["external", "external_gte", "internal"]]
12341230
] = None,
12351231
wait_for_active_shards: t.Optional[
12361232
t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -1475,8 +1471,8 @@ async def delete_by_query(
14751471
used only when the `q` query string parameter is specified.
14761472
:param conflicts: What to do if delete by query hits version conflicts: `abort`
14771473
or `proceed`.
1478-
:param default_operator: The default operator for query string query: `AND` or
1479-
`OR`. This parameter can be used only when the `q` query string parameter
1474+
:param default_operator: The default operator for query string query: `and` or
1475+
`or`. This parameter can be used only when the `q` query string parameter
14801476
is specified.
14811477
:param df: The field to use as default where no field prefix is given in the
14821478
query string. This parameter can be used only when the `q` query string parameter
@@ -1770,7 +1766,7 @@ async def exists(
17701766
stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
17711767
version: t.Optional[int] = None,
17721768
version_type: t.Optional[
1773-
t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1769+
t.Union[str, t.Literal["external", "external_gte", "internal"]]
17741770
] = None,
17751771
) -> HeadApiResponse:
17761772
"""
@@ -1899,7 +1895,7 @@ async def exists_source(
18991895
source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
19001896
version: t.Optional[int] = None,
19011897
version_type: t.Optional[
1902-
t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1898+
t.Union[str, t.Literal["external", "external_gte", "internal"]]
19031899
] = None,
19041900
) -> HeadApiResponse:
19051901
"""
@@ -2028,8 +2024,8 @@ async def explain(
20282024
This parameter can be used only when the `q` query string parameter is specified.
20292025
:param analyzer: The analyzer to use for the query string. This parameter can
20302026
be used only when the `q` query string parameter is specified.
2031-
:param default_operator: The default operator for query string query: `AND` or
2032-
`OR`. This parameter can be used only when the `q` query string parameter
2027+
:param default_operator: The default operator for query string query: `and` or
2028+
`or`. This parameter can be used only when the `q` query string parameter
20332029
is specified.
20342030
:param df: The field to use as default where no field prefix is given in the
20352031
query string. This parameter can be used only when the `q` query string parameter
@@ -2281,7 +2277,7 @@ async def get(
22812277
stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
22822278
version: t.Optional[int] = None,
22832279
version_type: t.Optional[
2284-
t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2280+
t.Union[str, t.Literal["external", "external_gte", "internal"]]
22852281
] = None,
22862282
) -> ObjectApiResponse[t.Any]:
22872283
"""
@@ -2571,7 +2567,7 @@ async def get_source(
25712567
source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
25722568
version: t.Optional[int] = None,
25732569
version_type: t.Optional[
2574-
t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2570+
t.Union[str, t.Literal["external", "external_gte", "internal"]]
25752571
] = None,
25762572
) -> ObjectApiResponse[t.Any]:
25772573
"""
@@ -2751,7 +2747,7 @@ async def index(
27512747
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
27522748
version: t.Optional[int] = None,
27532749
version_type: t.Optional[
2754-
t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2750+
t.Union[str, t.Literal["external", "external_gte", "internal"]]
27552751
] = None,
27562752
wait_for_active_shards: t.Optional[
27572753
t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -3438,7 +3434,7 @@ async def mtermvectors(
34383434
term_statistics: t.Optional[bool] = None,
34393435
version: t.Optional[int] = None,
34403436
version_type: t.Optional[
3441-
t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
3437+
t.Union[str, t.Literal["external", "external_gte", "internal"]]
34423438
] = None,
34433439
body: t.Optional[t.Dict[str, t.Any]] = None,
34443440
) -> ObjectApiResponse[t.Any]:
@@ -3856,7 +3852,7 @@ async def rank_eval(
38563852
)
38573853

38583854
@_rewrite_parameters(
3859-
body_fields=("dest", "source", "conflicts", "max_docs", "script", "size"),
3855+
body_fields=("dest", "source", "conflicts", "max_docs", "script"),
38603856
)
38613857
async def reindex(
38623858
self,
@@ -3874,7 +3870,6 @@ async def reindex(
38743870
require_alias: t.Optional[bool] = None,
38753871
script: t.Optional[t.Mapping[str, t.Any]] = None,
38763872
scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3877-
size: t.Optional[int] = None,
38783873
slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
38793874
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
38803875
wait_for_active_shards: t.Optional[
@@ -3950,7 +3945,6 @@ async def reindex(
39503945
reindexing.
39513946
:param scroll: The period of time that a consistent view of the index should
39523947
be maintained for scrolled search.
3953-
:param size:
39543948
:param slices: The number of slices this task should be divided into. It defaults
39553949
to one slice, which means the task isn't sliced into subtasks. Reindex supports
39563950
sliced scroll to parallelize the reindexing process. This parallelization
@@ -4015,8 +4009,6 @@ async def reindex(
40154009
__body["max_docs"] = max_docs
40164010
if script is not None:
40174011
__body["script"] = script
4018-
if size is not None:
4019-
__body["size"] = size
40204012
__headers = {"accept": "application/json", "content-type": "application/json"}
40214013
return await self.perform_request( # type: ignore[return-value]
40224014
"POST",
@@ -4143,11 +4135,7 @@ async def render_search_template(
41434135
__body["params"] = params
41444136
if source is not None:
41454137
__body["source"] = source
4146-
if not __body:
4147-
__body = None # type: ignore[assignment]
4148-
__headers = {"accept": "application/json"}
4149-
if __body is not None:
4150-
__headers["content-type"] = "application/json"
4138+
__headers = {"accept": "application/json", "content-type": "application/json"}
41514139
return await self.perform_request( # type: ignore[return-value]
41524140
"POST",
41534141
__path,
@@ -4230,11 +4218,7 @@ async def scripts_painless_execute(
42304218
__body["context_setup"] = context_setup
42314219
if script is not None:
42324220
__body["script"] = script
4233-
if not __body:
4234-
__body = None # type: ignore[assignment]
4235-
__headers = {"accept": "application/json"}
4236-
if __body is not None:
4237-
__headers["content-type"] = "application/json"
4221+
__headers = {"accept": "application/json", "content-type": "application/json"}
42384222
return await self.perform_request( # type: ignore[return-value]
42394223
"POST",
42404224
__path,
@@ -4512,8 +4496,8 @@ async def search(
45124496
node and the remote clusters are minimized when running cross-cluster search
45134497
(CCS) requests.
45144498
:param collapse: Collapses search results the values of the specified field.
4515-
:param default_operator: The default operator for the query string query: `AND`
4516-
or `OR`. This parameter can be used only when the `q` query string parameter
4499+
:param default_operator: The default operator for the query string query: `and`
4500+
or `or`. This parameter can be used only when the `q` query string parameter
45174501
is specified.
45184502
:param df: The field to use as a default when no field prefix is given in the
45194503
query string. This parameter can be used only when the `q` query string parameter
@@ -5691,11 +5675,7 @@ async def terms_enum(
56915675
__body["string"] = string
56925676
if timeout is not None:
56935677
__body["timeout"] = timeout
5694-
if not __body:
5695-
__body = None # type: ignore[assignment]
5696-
__headers = {"accept": "application/json"}
5697-
if __body is not None:
5698-
__headers["content-type"] = "application/json"
5678+
__headers = {"accept": "application/json", "content-type": "application/json"}
56995679
return await self.perform_request( # type: ignore[return-value]
57005680
"POST",
57015681
__path,
@@ -5745,7 +5725,7 @@ async def termvectors(
57455725
term_statistics: t.Optional[bool] = None,
57465726
version: t.Optional[int] = None,
57475727
version_type: t.Optional[
5748-
t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
5728+
t.Union[str, t.Literal["external", "external_gte", "internal"]]
57495729
] = None,
57505730
body: t.Optional[t.Dict[str, t.Any]] = None,
57515731
) -> ObjectApiResponse[t.Any]:
@@ -6221,8 +6201,8 @@ async def update_by_query(
62216201
be used only when the `q` query string parameter is specified.
62226202
:param conflicts: The preferred behavior when update by query hits version conflicts:
62236203
`abort` or `proceed`.
6224-
:param default_operator: The default operator for query string query: `AND` or
6225-
`OR`. This parameter can be used only when the `q` query string parameter
6204+
:param default_operator: The default operator for query string query: `and` or
6205+
`or`. This parameter can be used only when the `q` query string parameter
62266206
is specified.
62276207
:param df: The field to use as default where no field prefix is given in the
62286208
query string. This parameter can be used only when the `q` query string parameter

elasticsearch/_async/client/cat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ async def ml_data_frame_analytics(
15431543
15441544
:param id: The ID of the data frame analytics to fetch
15451545
:param allow_no_match: Whether to ignore if a wildcard expression matches no
1546-
configs. (This includes `_all` string or when no configs have been specified)
1546+
configs. (This includes `_all` string or when no configs have been specified.)
15471547
:param bytes: Sets the units for columns that contain a byte-size value. Note
15481548
that byte-size value units work in terms of powers of 1024. For instance
15491549
`1kb` means 1024 bytes, not 1000 bytes. If omitted, byte-size values are
@@ -2516,6 +2516,7 @@ async def nodes(
25162516
t.Union[
25172517
str,
25182518
t.Literal[
2519+
"available_processors",
25192520
"build",
25202521
"completion.size",
25212522
"cpu",
@@ -2611,6 +2612,7 @@ async def nodes(
26112612
t.Union[
26122613
str,
26132614
t.Literal[
2615+
"available_processors",
26142616
"build",
26152617
"completion.size",
26162618
"cpu",

elasticsearch/_async/client/connector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async def delete(
103103
104104
:param connector_id: The unique identifier of the connector to be deleted
105105
:param delete_sync_jobs: A flag indicating if associated sync jobs should be
106-
also removed. Defaults to false.
106+
also removed.
107107
:param hard: A flag indicating if the connector should be hard deleted.
108108
"""
109109
if connector_id in SKIP_IN_PATH:
@@ -360,7 +360,7 @@ async def list(
360360
361361
:param connector_name: A comma-separated list of connector names to fetch connector
362362
documents for
363-
:param from_: Starting offset (default: 0)
363+
:param from_: Starting offset
364364
:param include_deleted: A flag to indicate if the desired connector should be
365365
fetched, even if it was soft-deleted.
366366
:param index_name: A comma-separated list of connector index names to fetch connector
@@ -955,7 +955,7 @@ async def sync_job_list(
955955
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-connector-sync-job-list>`_
956956
957957
:param connector_id: A connector id to fetch connector sync jobs for
958-
:param from_: Starting offset (default: 0)
958+
:param from_: Starting offset
959959
:param job_type: A comma-separated list of job types to fetch the sync jobs for
960960
:param size: Specifies a max number of results to get
961961
:param status: A sync job status to fetch connector sync jobs for

elasticsearch/_async/client/fleet.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -642,11 +642,7 @@ async def search(
642642
__body["track_total_hits"] = track_total_hits
643643
if version is not None:
644644
__body["version"] = version
645-
if not __body:
646-
__body = None # type: ignore[assignment]
647-
__headers = {"accept": "application/json"}
648-
if __body is not None:
649-
__headers["content-type"] = "application/json"
645+
__headers = {"accept": "application/json", "content-type": "application/json"}
650646
return await self.perform_request( # type: ignore[return-value]
651647
"POST",
652648
__path,

elasticsearch/_async/client/graph.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ async def explore(
9797
__body["query"] = query
9898
if vertices is not None:
9999
__body["vertices"] = vertices
100-
if not __body:
101-
__body = None # type: ignore[assignment]
102-
__headers = {"accept": "application/json"}
103-
if __body is not None:
104-
__headers["content-type"] = "application/json"
100+
__headers = {"accept": "application/json", "content-type": "application/json"}
105101
return await self.perform_request( # type: ignore[return-value]
106102
"POST",
107103
__path,

elasticsearch/_async/client/ilm.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,7 @@ async def move_to_step(
383383
__body["current_step"] = current_step
384384
if next_step is not None:
385385
__body["next_step"] = next_step
386-
if not __body:
387-
__body = None # type: ignore[assignment]
388-
__headers = {"accept": "application/json"}
389-
if __body is not None:
390-
__headers["content-type"] = "application/json"
386+
__headers = {"accept": "application/json", "content-type": "application/json"}
391387
return await self.perform_request( # type: ignore[return-value]
392388
"POST",
393389
__path,
@@ -453,11 +449,7 @@ async def put_lifecycle(
453449
if not __body:
454450
if policy is not None:
455451
__body["policy"] = policy
456-
if not __body:
457-
__body = None # type: ignore[assignment]
458-
__headers = {"accept": "application/json"}
459-
if __body is not None:
460-
__headers["content-type"] = "application/json"
452+
__headers = {"accept": "application/json", "content-type": "application/json"}
461453
return await self.perform_request( # type: ignore[return-value]
462454
"PUT",
463455
__path,

0 commit comments

Comments
 (0)