Skip to content

Commit c81b3db

Browse files
Auto-generated API code (#3226)
1 parent 566e99a commit c81b3db

Some content is hidden

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

61 files changed

+1231
-369
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,11 @@ async def delete_by_query(
16271627
__body["slice"] = slice
16281628
if sort is not None:
16291629
__body["sort"] = sort
1630-
__headers = {"accept": "application/json", "content-type": "application/json"}
1630+
if not __body:
1631+
__body = None # type: ignore[assignment]
1632+
__headers = {"accept": "application/json"}
1633+
if __body is not None:
1634+
__headers["content-type"] = "application/json"
16311635
return await self.perform_request( # type: ignore[return-value]
16321636
"POST",
16331637
__path,
@@ -2830,13 +2834,11 @@ async def index(
28302834
"id": "elkbee"
28312835
}
28322836
}
2833-
2834-
In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.
2835-
If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).
2836-
2837-
A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.
2838-
Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.
28392837
</code></pre>
2838+
<p>In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.
2839+
If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).</p>
2840+
<p>A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.
2841+
Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.</p>
28402842
28412843
28422844
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create>`_
@@ -3116,7 +3118,11 @@ async def mget(
31163118
__body["docs"] = docs
31173119
if ids is not None:
31183120
__body["ids"] = ids
3119-
__headers = {"accept": "application/json", "content-type": "application/json"}
3121+
if not __body:
3122+
__body = None # type: ignore[assignment]
3123+
__headers = {"accept": "application/json"}
3124+
if __body is not None:
3125+
__headers["content-type"] = "application/json"
31203126
return await self.perform_request( # type: ignore[return-value]
31213127
"POST",
31223128
__path,
@@ -3716,7 +3722,11 @@ async def put_script(
37163722
if not __body:
37173723
if script is not None:
37183724
__body["script"] = script
3719-
__headers = {"accept": "application/json", "content-type": "application/json"}
3725+
if not __body:
3726+
__body = None # type: ignore[assignment]
3727+
__headers = {"accept": "application/json"}
3728+
if __body is not None:
3729+
__headers["content-type"] = "application/json"
37203730
return await self.perform_request( # type: ignore[return-value]
37213731
"PUT",
37223732
__path,
@@ -3812,7 +3822,11 @@ async def rank_eval(
38123822
__body["requests"] = requests
38133823
if metric is not None:
38143824
__body["metric"] = metric
3815-
__headers = {"accept": "application/json", "content-type": "application/json"}
3825+
if not __body:
3826+
__body = None # type: ignore[assignment]
3827+
__headers = {"accept": "application/json"}
3828+
if __body is not None:
3829+
__headers["content-type"] = "application/json"
38163830
return await self.perform_request( # type: ignore[return-value]
38173831
"POST",
38183832
__path,
@@ -3985,7 +3999,11 @@ async def reindex(
39853999
__body["script"] = script
39864000
if size is not None:
39874001
__body["size"] = size
3988-
__headers = {"accept": "application/json", "content-type": "application/json"}
4002+
if not __body:
4003+
__body = None # type: ignore[assignment]
4004+
__headers = {"accept": "application/json"}
4005+
if __body is not None:
4006+
__headers["content-type"] = "application/json"
39894007
return await self.perform_request( # type: ignore[return-value]
39904008
"POST",
39914009
__path,
@@ -5156,11 +5174,19 @@ async def search_mvt(
51565174
51575175
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search-mvt>`_
51585176
5159-
:param index: Comma-separated list of data streams, indices, or aliases to search
5160-
:param field: Field containing geospatial data to return
5161-
:param zoom: Zoom level for the vector tile to search
5162-
:param x: X coordinate for the vector tile to search
5163-
:param y: Y coordinate for the vector tile to search
5177+
:param index: A list of indices, data streams, or aliases to search. It supports
5178+
wildcards (`*`). To search all data streams and indices, omit this parameter
5179+
or use `*` or `_all`. To search a remote cluster, use the `<cluster>:<target>`
5180+
syntax.
5181+
:param field: A field that contains the geospatial data to return. It must be
5182+
a `geo_point` or `geo_shape` field. The field must have doc values enabled.
5183+
It cannot be a nested field. NOTE: Vector tiles do not natively support geometry
5184+
collections. For `geometrycollection` values in a `geo_shape` field, the
5185+
API returns a hits layer feature for each element of the collection. This
5186+
behavior may change in a future release.
5187+
:param zoom: The zoom level of the vector tile to search. It accepts `0` to `29`.
5188+
:param x: The X coordinate for the vector tile to search.
5189+
:param y: The Y coordinate for the vector tile to search.
51645190
:param aggs: Sub-aggregations for the geotile_grid. It supports the following
51655191
aggregation types: - `avg` - `boxplot` - `cardinality` - `extended stats`
51665192
- `max` - `median absolute deviation` - `min` - `percentile` - `percentile-rank`
@@ -5530,7 +5556,11 @@ async def search_template(
55305556
__body["profile"] = profile
55315557
if source is not None:
55325558
__body["source"] = source
5533-
__headers = {"accept": "application/json", "content-type": "application/json"}
5559+
if not __body:
5560+
__body = None # type: ignore[assignment]
5561+
__headers = {"accept": "application/json"}
5562+
if __body is not None:
5563+
__headers["content-type"] = "application/json"
55345564
return await self.perform_request( # type: ignore[return-value]
55355565
"POST",
55365566
__path,
@@ -6001,7 +6031,11 @@ async def update(
60016031
__body["_source"] = source
60026032
if upsert is not None:
60036033
__body["upsert"] = upsert
6004-
__headers = {"accept": "application/json", "content-type": "application/json"}
6034+
if not __body:
6035+
__body = None # type: ignore[assignment]
6036+
__headers = {"accept": "application/json"}
6037+
if __body is not None:
6038+
__headers["content-type"] = "application/json"
60056039
return await self.perform_request( # type: ignore[return-value]
60066040
"POST",
60076041
__path,

elasticsearch/_async/client/async_search.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ async def submit(
357357
:param allow_partial_search_results: Indicate if an error should be returned
358358
if there is a partial search failure or timeout
359359
:param analyze_wildcard: Specify whether wildcard and prefix queries should be
360-
analyzed (default: false)
360+
analyzed
361361
:param analyzer: The analyzer to use for the query string
362362
:param batched_reduce_size: Affects how often partial results become available,
363363
which happens whenever shard results are reduced. A partial reduction is
@@ -373,7 +373,7 @@ async def submit(
373373
values for field names matching these patterns in the hits.fields property
374374
of the response.
375375
:param expand_wildcards: Whether to expand wildcard expression to concrete indices
376-
that are open, closed or both.
376+
that are open, closed or both
377377
:param explain: If true, returns detailed information about score computation
378378
as part of a hit.
379379
:param ext: Configuration of search extensions defined by Elasticsearch plugins.
@@ -406,7 +406,7 @@ async def submit(
406406
you cannot specify an <index> in the request path.
407407
:param post_filter:
408408
:param preference: Specify the node or shard the operation should be performed
409-
on (default: random)
409+
on
410410
:param profile:
411411
:param q: Query in the Lucene query string syntax
412412
:param query: Defines the search definition using the Query DSL.

elasticsearch/_async/client/autoscaling.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async def delete_autoscaling_policy(
5050
5151
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-autoscaling-delete-autoscaling-policy>`_
5252
53-
:param name: the name of the autoscaling policy
53+
:param name: Name of the autoscaling policy
5454
:param master_timeout: Period to wait for a connection to the master node. If
5555
no response is received before the timeout expires, the request fails and
5656
returns an error.
@@ -157,7 +157,7 @@ async def get_autoscaling_policy(
157157
158158
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-autoscaling-get-autoscaling-capacity>`_
159159
160-
:param name: the name of the autoscaling policy
160+
:param name: Name of the autoscaling policy
161161
:param master_timeout: Period to wait for a connection to the master node. If
162162
no response is received before the timeout expires, the request fails and
163163
returns an error.
@@ -212,7 +212,7 @@ async def put_autoscaling_policy(
212212
213213
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-autoscaling-put-autoscaling-policy>`_
214214
215-
:param name: the name of the autoscaling policy
215+
:param name: Name of the autoscaling policy
216216
:param policy:
217217
:param master_timeout: Period to wait for a connection to the master node. If
218218
no response is received before the timeout expires, the request fails and

elasticsearch/_async/client/ccr.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ async def follow(
229229
__body["read_poll_timeout"] = read_poll_timeout
230230
if settings is not None:
231231
__body["settings"] = settings
232-
__headers = {"accept": "application/json", "content-type": "application/json"}
232+
if not __body:
233+
__body = None # type: ignore[assignment]
234+
__headers = {"accept": "application/json"}
235+
if __body is not None:
236+
__headers["content-type"] = "application/json"
233237
return await self.perform_request( # type: ignore[return-value]
234238
"PUT",
235239
__path,
@@ -382,7 +386,7 @@ async def forget_follower(
382386
383387
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-forget-follower>`_
384388
385-
:param index: the name of the leader index for which specified follower retention
389+
:param index: Name of the leader index for which specified follower retention
386390
leases should be removed
387391
:param follower_cluster:
388392
:param follower_index:
@@ -416,7 +420,11 @@ async def forget_follower(
416420
__body["follower_index_uuid"] = follower_index_uuid
417421
if leader_remote_cluster is not None:
418422
__body["leader_remote_cluster"] = leader_remote_cluster
419-
__headers = {"accept": "application/json", "content-type": "application/json"}
423+
if not __body:
424+
__body = None # type: ignore[assignment]
425+
__headers = {"accept": "application/json"}
426+
if __body is not None:
427+
__headers["content-type"] = "application/json"
420428
return await self.perform_request( # type: ignore[return-value]
421429
"POST",
422430
__path,
@@ -751,7 +759,11 @@ async def put_auto_follow_pattern(
751759
__body["read_poll_timeout"] = read_poll_timeout
752760
if settings is not None:
753761
__body["settings"] = settings
754-
__headers = {"accept": "application/json", "content-type": "application/json"}
762+
if not __body:
763+
__body = None # type: ignore[assignment]
764+
__headers = {"accept": "application/json"}
765+
if __body is not None:
766+
__headers["content-type"] = "application/json"
755767
return await self.perform_request( # type: ignore[return-value]
756768
"PUT",
757769
__path,
@@ -862,7 +874,7 @@ async def resume_follow(
862874
863875
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-resume-follow>`_
864876
865-
:param index: The name of the follow index to resume following.
877+
:param index: Name of the follow index to resume following
866878
:param master_timeout: Period to wait for a connection to the master node.
867879
:param max_outstanding_read_requests:
868880
:param max_outstanding_write_requests:

elasticsearch/_async/client/cluster.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ async def get_component_template(
306306
request. Wildcard (`*`) expressions are supported.
307307
:param flat_settings: If `true`, returns settings in flat format.
308308
:param include_defaults: Return all default configurations for the component
309-
template (default: false)
309+
template
310310
:param local: If `true`, the request retrieves information from the local node
311311
only. If `false`, information is retrieved from the master node.
312312
:param master_timeout: Period to wait for a connection to the master node. If
@@ -834,7 +834,11 @@ async def put_component_template(
834834
__body["_meta"] = meta
835835
if version is not None:
836836
__body["version"] = version
837-
__headers = {"accept": "application/json", "content-type": "application/json"}
837+
if not __body:
838+
__body = None # type: ignore[assignment]
839+
__headers = {"accept": "application/json"}
840+
if __body is not None:
841+
__headers["content-type"] = "application/json"
838842
return await self.perform_request( # type: ignore[return-value]
839843
"PUT",
840844
__path,
@@ -883,10 +887,10 @@ async def put_settings(
883887
884888
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-put-settings>`_
885889
886-
:param flat_settings: Return settings in flat format (default: false)
887-
:param master_timeout: Explicit operation timeout for connection to master node
890+
:param flat_settings: Return settings in flat format
891+
:param master_timeout: The period to wait for a connection to the master node.
888892
:param persistent: The settings that persist after the cluster restarts.
889-
:param timeout: Explicit operation timeout
893+
:param timeout: The period to wait for a response.
890894
:param transient: The settings that do not persist after the cluster restarts.
891895
"""
892896
__path_parts: t.Dict[str, str] = {}
@@ -912,7 +916,11 @@ async def put_settings(
912916
__body["persistent"] = persistent
913917
if transient is not None:
914918
__body["transient"] = transient
915-
__headers = {"accept": "application/json", "content-type": "application/json"}
919+
if not __body:
920+
__body = None # type: ignore[assignment]
921+
__headers = {"accept": "application/json"}
922+
if __body is not None:
923+
__headers["content-type"] = "application/json"
916924
return await self.perform_request( # type: ignore[return-value]
917925
"PUT",
918926
__path,
@@ -1111,19 +1119,19 @@ async def state(
11111119
11121120
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-state>`_
11131121
1114-
:param metric: Limit the information returned to the specified metrics
1122+
:param metric: Limit the information returned to the specified metrics.
11151123
:param index: A comma-separated list of index names; use `_all` or empty string
11161124
to perform the operation on all indices
11171125
:param allow_no_indices: Whether to ignore if a wildcard indices expression resolves
11181126
into no concrete indices. (This includes `_all` string or when no indices
11191127
have been specified)
11201128
:param expand_wildcards: Whether to expand wildcard expression to concrete indices
1121-
that are open, closed or both.
1122-
:param flat_settings: Return settings in flat format (default: false)
1129+
that are open, closed or both
1130+
:param flat_settings: Return settings in flat format
11231131
:param ignore_unavailable: Whether specified concrete indices should be ignored
11241132
when unavailable (missing or closed)
11251133
:param local: Return local information, do not retrieve the state from master
1126-
node (default: false)
1134+
node
11271135
:param master_timeout: Timeout for waiting for new cluster state in case it is
11281136
blocked
11291137
:param wait_for_metadata_version: Wait for the metadata version to be equal or

0 commit comments

Comments
 (0)