Skip to content

Commit cacf718

Browse files
committed
Make all parameters keyword-only in type stubs
1 parent fbaad7d commit cacf718

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+784
-802
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -471,15 +471,15 @@ async def bulk(self, body, index=None, doc_type=None, params=None, headers=None)
471471
)
472472

473473
@query_params()
474-
async def clear_scroll(self, body=None, scroll_id=None, params=None, headers=None):
474+
async def clear_scroll(self, scroll_id=None, body=None, params=None, headers=None):
475475
"""
476476
Explicitly clears the search context for a scroll.
477477
478478
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/clear-scroll-api.html>`_
479479
480+
:arg scroll_id: A comma-separated list of scroll IDs to clear
480481
:arg body: A comma-separated list of scroll IDs to clear if none
481482
was specified via the scroll_id parameter
482-
:arg scroll_id: A comma-separated list of scroll IDs to clear
483483
"""
484484
if scroll_id in SKIP_IN_PATH and body in SKIP_IN_PATH:
485485
raise ValueError("You need to supply scroll_id or body.")
@@ -509,15 +509,13 @@ async def clear_scroll(self, body=None, scroll_id=None, params=None, headers=Non
509509
"terminate_after",
510510
)
511511
async def count(
512-
self, body=None, index=None, doc_type=None, params=None, headers=None
512+
self, index=None, doc_type=None, body=None, params=None, headers=None
513513
):
514514
"""
515515
Returns number of documents matching a query.
516516
517517
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-count.html>`_
518518
519-
:arg body: A query to restrict the results specified with the
520-
Query DSL (optional)
521519
:arg index: A comma-separated list of indices to restrict the
522520
results
523521
:arg doc_type: A comma-separated list of types to restrict the
@@ -549,6 +547,8 @@ async def count(
549547
:arg routing: A comma-separated list of specific routing values
550548
:arg terminate_after: The maximum count for each shard, upon
551549
reaching which the query execution will terminate early
550+
:arg body: A query to restrict the results specified with the
551+
Query DSL (optional)
552552
"""
553553
return await self.transport.perform_request(
554554
"POST",
@@ -899,7 +899,7 @@ async def exists_source(self, index, id, doc_type=None, params=None, headers=Non
899899
"stored_fields",
900900
)
901901
async def explain(
902-
self, index, id, body=None, doc_type=None, params=None, headers=None
902+
self, index, id, doc_type=None, body=None, params=None, headers=None
903903
):
904904
"""
905905
Returns information about why a specific matches (or doesn't match) a query.
@@ -908,7 +908,6 @@ async def explain(
908908
909909
:arg index: The name of the index
910910
:arg id: The document ID
911-
:arg body: The query definition using the Query DSL
912911
:arg doc_type: The type of the document
913912
:arg _source: True or false to return the _source field or not,
914913
or a list of fields to return
@@ -931,6 +930,7 @@ async def explain(
931930
:arg routing: Specific routing value
932931
:arg stored_fields: A comma-separated list of stored fields to
933932
return in the response
933+
:arg body: The query definition using the Query DSL
934934
"""
935935
for param in (index, id):
936936
if param in SKIP_IN_PATH:
@@ -952,14 +952,13 @@ async def explain(
952952
"ignore_unavailable",
953953
"include_unmapped",
954954
)
955-
async def field_caps(self, body=None, index=None, params=None, headers=None):
955+
async def field_caps(self, index=None, body=None, params=None, headers=None):
956956
"""
957957
Returns the information about the capabilities of fields among multiple
958958
indices.
959959
960960
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-field-caps.html>`_
961961
962-
:arg body: An index filter specified with the Query DSL
963962
:arg index: A comma-separated list of index names; use `_all` or
964963
empty string to perform the operation on all indices
965964
:arg allow_no_indices: Whether to ignore if a wildcard indices
@@ -973,6 +972,7 @@ async def field_caps(self, body=None, index=None, params=None, headers=None):
973972
should be ignored when unavailable (missing or closed)
974973
:arg include_unmapped: Indicates whether unmapped fields should
975974
be included in the response.
975+
:arg body: An index filter specified with the Query DSL
976976
"""
977977
return await self.transport.perform_request(
978978
"POST",
@@ -1266,16 +1266,13 @@ async def msearch_template(
12661266
"version_type",
12671267
)
12681268
async def mtermvectors(
1269-
self, body=None, index=None, doc_type=None, params=None, headers=None
1269+
self, index=None, doc_type=None, body=None, params=None, headers=None
12701270
):
12711271
"""
12721272
Returns multiple termvectors in one request.
12731273
12741274
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-multi-termvectors.html>`_
12751275
1276-
:arg body: Define ids, documents, parameters or a list of
1277-
parameters per document here. You must at least provide a list of
1278-
document ids. See documentation.
12791276
:arg index: The index in which the document resides.
12801277
:arg doc_type: The type of the document.
12811278
:arg field_statistics: Specifies if document count, sum of
@@ -1309,6 +1306,9 @@ async def mtermvectors(
13091306
:arg version: Explicit version number for concurrency control
13101307
:arg version_type: Specific version type Valid choices:
13111308
internal, external, external_gte, force
1309+
:arg body: Define ids, documents, parameters or a list of
1310+
parameters per document here. You must at least provide a list of
1311+
document ids. See documentation.
13121312
"""
13131313
if doc_type in SKIP_IN_PATH:
13141314
path = _make_path(index, "_mtermvectors")
@@ -1328,7 +1328,7 @@ async def put_script(self, id, body, context=None, params=None, headers=None):
13281328
13291329
:arg id: Script ID
13301330
:arg body: The document
1331-
:arg context: Context name to compile script against
1331+
:arg context: Script context
13321332
:arg master_timeout: Specify timeout for connection to master
13331333
:arg timeout: Explicit operation timeout
13341334
"""
@@ -1455,15 +1455,15 @@ async def reindex_rethrottle(self, task_id, params=None, headers=None):
14551455

14561456
@query_params()
14571457
async def render_search_template(
1458-
self, body=None, id=None, params=None, headers=None
1458+
self, id=None, body=None, params=None, headers=None
14591459
):
14601460
"""
14611461
Allows to use the Mustache language to pre-render a search definition.
14621462
14631463
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/render-search-template-api.html>`_
14641464
1465-
:arg body: The search definition template and its params
14661465
:arg id: The id of the stored search template
1466+
:arg body: The search definition template and its params
14671467
"""
14681468
return await self.transport.perform_request(
14691469
"POST",
@@ -1496,19 +1496,19 @@ async def scripts_painless_execute(self, body=None, params=None, headers=None):
14961496
)
14971497

14981498
@query_params("rest_total_hits_as_int", "scroll")
1499-
async def scroll(self, body=None, scroll_id=None, params=None, headers=None):
1499+
async def scroll(self, scroll_id=None, body=None, params=None, headers=None):
15001500
"""
15011501
Allows to retrieve a large numbers of results from a single search request.
15021502
15031503
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-request-body.html#request-body-search-scroll>`_
15041504
1505-
:arg body: The scroll ID if not passed by URL or query
1506-
parameter.
1507-
:arg scroll_id: The scroll ID for scrolled search
1505+
:arg scroll_id: The scroll ID
15081506
:arg rest_total_hits_as_int: Indicates whether hits.total should
15091507
be rendered as an integer or an object in the rest search response
15101508
:arg scroll: Specify how long a consistent view of the index
15111509
should be maintained for scrolled search
1510+
:arg body: The scroll ID if not passed by URL or query
1511+
parameter.
15121512
"""
15131513
if scroll_id in SKIP_IN_PATH and body in SKIP_IN_PATH:
15141514
raise ValueError("You need to supply scroll_id or body.")
@@ -1567,14 +1567,13 @@ async def scroll(self, body=None, scroll_id=None, params=None, headers=None):
15671567
"version",
15681568
)
15691569
async def search(
1570-
self, body=None, index=None, doc_type=None, params=None, headers=None
1570+
self, index=None, doc_type=None, body=None, params=None, headers=None
15711571
):
15721572
"""
15731573
Returns results matching a query.
15741574
15751575
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-search.html>`_
15761576
1577-
:arg body: The search definition using the Query DSL
15781577
:arg index: A comma-separated list of index names to search; use
15791578
`_all` or empty string to perform the operation on all indices
15801579
:arg doc_type: A comma-separated list of document types to
@@ -1672,6 +1671,7 @@ async def search(
16721671
should be prefixed by their respective types in the response
16731672
:arg version: Specify whether to return document version as part
16741673
of a hit
1674+
:arg body: The search definition using the Query DSL
16751675
"""
16761676
# from is a reserved word so it cannot be used, use from_ instead
16771677
if "from_" in params:
@@ -1801,7 +1801,7 @@ async def search_template(
18011801
"version_type",
18021802
)
18031803
async def termvectors(
1804-
self, index, body=None, doc_type=None, id=None, params=None, headers=None
1804+
self, index, doc_type=None, id=None, body=None, params=None, headers=None
18051805
):
18061806
"""
18071807
Returns information and statistics about terms in the fields of a particular
@@ -1810,8 +1810,6 @@ async def termvectors(
18101810
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-termvectors.html>`_
18111811
18121812
:arg index: The index in which the document resides.
1813-
:arg body: Define parameters and or supply a document to get
1814-
termvectors for. See documentation.
18151813
:arg doc_type: The type of the document.
18161814
:arg id: The id of the document, when not specified a doc param
18171815
should be supplied.
@@ -1835,6 +1833,8 @@ async def termvectors(
18351833
:arg version: Explicit version number for concurrency control
18361834
:arg version_type: Specific version type Valid choices:
18371835
internal, external, external_gte, force
1836+
:arg body: Define parameters and or supply a document to get
1837+
termvectors for. See documentation.
18381838
"""
18391839
if index in SKIP_IN_PATH:
18401840
raise ValueError("Empty value passed for a required argument 'index'.")
@@ -1953,7 +1953,7 @@ async def update(self, index, id, body, doc_type=None, params=None, headers=None
19531953
"wait_for_completion",
19541954
)
19551955
async def update_by_query(
1956-
self, index, body=None, doc_type=None, params=None, headers=None
1956+
self, index, doc_type=None, body=None, params=None, headers=None
19571957
):
19581958
"""
19591959
Performs an update on every document in the index without changing the source,
@@ -1963,7 +1963,6 @@ async def update_by_query(
19631963
19641964
:arg index: A comma-separated list of index names to search; use
19651965
`_all` or empty string to perform the operation on all indices
1966-
:arg body: The search definition using the Query DSL
19671966
:arg doc_type: A comma-separated list of document types to
19681967
search; leave empty to perform the operation on all types
19691968
:arg _source: True or false to return the _source field or not,
@@ -2037,6 +2036,7 @@ async def update_by_query(
20372036
+ 1)
20382037
:arg wait_for_completion: Should the request should block until
20392038
the update by query operation is complete. Default: True
2039+
:arg body: The search definition using the Query DSL
20402040
"""
20412041
# from is a reserved word so it cannot be used, use from_ instead
20422042
if "from_" in params:
@@ -2197,7 +2197,6 @@ async def search_mvt(
21972197
:arg zoom: Zoom level for the vector tile to search
21982198
:arg x: X coordinate for the vector tile to search
21992199
:arg y: Y coordinate for the vector tile to search
2200-
:arg body: Search request body.
22012200
:arg exact_bounds: If false, the meta layer's feature is the
22022201
bounding box of the tile. If true, the meta layer's feature is a
22032202
bounding box resulting from a `geo_bounds` aggregation.
@@ -2209,6 +2208,7 @@ async def search_mvt(
22092208
aggs layer. Valid choices: grid, point Default: grid
22102209
:arg size: Maximum number of features to return in the hits
22112210
layer. Accepts 0-10000. Default: 10000
2211+
:arg body: Search request body.
22122212
"""
22132213
for param in (index, field, zoom, x, y):
22142214
if param in SKIP_IN_PATH:

0 commit comments

Comments
 (0)