Skip to content

Commit

Permalink
Auto-generated code for main (#2671)
Browse files Browse the repository at this point in the history
Co-authored-by: Quentin Pradet <[email protected]>
  • Loading branch information
elasticmachine and pquentin authored Nov 6, 2024
1 parent 596e7ca commit 94573cf
Show file tree
Hide file tree
Showing 24 changed files with 1,288 additions and 512 deletions.
137 changes: 98 additions & 39 deletions elasticsearch/_async/client/__init__.py

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions elasticsearch/_async/client/async_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ async def delete(
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Deletes an async search by identifier. If the search is still running, the search
request will be cancelled. Otherwise, the saved search results are deleted. If
the Elasticsearch security features are enabled, the deletion of a specific async
search is restricted to: the authenticated user that submitted the original search
request; users that have the `cancel_task` cluster privilege.
Delete an async search. If the asynchronous search is still running, it is cancelled.
Otherwise, the saved search results are deleted. If the Elasticsearch security
features are enabled, the deletion of a specific async search is restricted to:
the authenticated user that submitted the original search request; users that
have the `cancel_task` cluster privilege.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/async-search.html>`_
Expand Down Expand Up @@ -85,9 +85,9 @@ async def get(
] = None,
) -> ObjectApiResponse[t.Any]:
"""
Retrieves the results of a previously submitted async search request given its
identifier. If the Elasticsearch security features are enabled, access to the
results of a specific async search is restricted to the user or API key that
Get async search results. Retrieve the results of a previously submitted asynchronous
search request. If the Elasticsearch security features are enabled, access to
the results of a specific async search is restricted to the user or API key that
submitted it.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/async-search.html>`_
Expand Down Expand Up @@ -148,10 +148,10 @@ async def status(
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Get async search status Retrieves the status of a previously submitted async
search request given its identifier, without retrieving search results. If the
Elasticsearch security features are enabled, use of this API is restricted to
the `monitoring_user` role.
Get the async search status. Get the status of a previously submitted async search
request given its identifier, without retrieving search results. If the Elasticsearch
security features are enabled, use of this API is restricted to the `monitoring_user`
role.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/async-search.html>`_
Expand Down Expand Up @@ -323,15 +323,15 @@ async def submit(
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Runs a search request asynchronously. When the primary sort of the results is
an indexed field, shards get sorted based on minimum and maximum value that they
hold for that field, hence partial results become available following the sort
criteria that was requested. Warning: Async search does not support scroll nor
search requests that only include the suggest section. By default, Elasticsearch
doesn’t allow you to store an async search response larger than 10Mb and an attempt
to do this results in an error. The maximum allowed size for a stored async search
response can be set by changing the `search.max_async_search_response_size` cluster
level setting.
Run an async search. When the primary sort of the results is an indexed field,
shards get sorted based on minimum and maximum value that they hold for that
field. Partial results become available following the sort criteria that was
requested. Warning: Asynchronous search does not support scroll or search requests
that include only the suggest section. By default, Elasticsearch does not allow
you to store an async search response larger than 10Mb and an attempt to do this
results in an error. The maximum allowed size for a stored async search response
can be set by changing the `search.max_async_search_response_size` cluster level
setting.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/async-search.html>`_
Expand Down
25 changes: 19 additions & 6 deletions elasticsearch/_async/client/autoscaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ async def delete_autoscaling_policy(
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK.
Delete an autoscaling policy. NOTE: This feature is designed for indirect use
by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes.
Direct use is not supported.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-delete-autoscaling-policy.html>`_
Expand Down Expand Up @@ -76,8 +77,18 @@ async def get_autoscaling_capacity(
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Gets the current autoscaling capacity based on the configured autoscaling policy.
Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.
Get the autoscaling capacity. NOTE: This feature is designed for indirect use
by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes.
Direct use is not supported. This API gets the current autoscaling capacity based
on the configured autoscaling policy. It will return information to size the
cluster appropriately to the current workload. The `required_capacity` is calculated
as the maximum of the `required_capacity` result of all individual deciders that
are enabled for the policy. The operator should verify that the `current_nodes`
match the operator’s knowledge of the cluster to avoid making autoscaling decisions
based on stale or incomplete information. The response contains decider-specific
information you can use to diagnose how and why autoscaling determined a certain
capacity was required. This information is provided for diagnosis only. Do not
use this information to make autoscaling decisions.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-get-autoscaling-capacity.html>`_
"""
Expand Down Expand Up @@ -113,7 +124,8 @@ async def get_autoscaling_policy(
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK.
Get an autoscaling policy. NOTE: This feature is designed for indirect use by
Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes.
Direct use is not supported.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-get-autoscaling-capacity.html>`_
Expand Down Expand Up @@ -158,8 +170,9 @@ async def put_autoscaling_policy(
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK.
Direct use is not supported.
Create or update an autoscaling policy. NOTE: This feature is designed for indirect
use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on
Kubernetes. Direct use is not supported.
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-put-autoscaling-policy.html>`_
Expand Down
83 changes: 58 additions & 25 deletions elasticsearch/_async/client/ccr.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ async def delete_auto_follow_pattern(
@_rewrite_parameters(
body_fields=(
"leader_index",
"remote_cluster",
"data_stream_name",
"max_outstanding_read_requests",
"max_outstanding_write_requests",
"max_read_request_operation_count",
Expand All @@ -78,29 +80,31 @@ async def delete_auto_follow_pattern(
"max_write_request_operation_count",
"max_write_request_size",
"read_poll_timeout",
"remote_cluster",
"settings",
),
)
async def follow(
self,
*,
index: str,
leader_index: t.Optional[str] = None,
remote_cluster: t.Optional[str] = None,
data_stream_name: t.Optional[str] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
leader_index: t.Optional[str] = None,
max_outstanding_read_requests: t.Optional[int] = None,
max_outstanding_write_requests: t.Optional[int] = None,
max_read_request_operation_count: t.Optional[int] = None,
max_read_request_size: t.Optional[str] = None,
max_read_request_size: t.Optional[t.Union[int, str]] = None,
max_retry_delay: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
max_write_buffer_count: t.Optional[int] = None,
max_write_buffer_size: t.Optional[str] = None,
max_write_buffer_size: t.Optional[t.Union[int, str]] = None,
max_write_request_operation_count: t.Optional[int] = None,
max_write_request_size: t.Optional[str] = None,
max_write_request_size: t.Optional[t.Union[int, str]] = None,
pretty: t.Optional[bool] = None,
read_poll_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
remote_cluster: t.Optional[str] = None,
settings: t.Optional[t.Mapping[str, t.Any]] = None,
wait_for_active_shards: t.Optional[
t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
] = None,
Expand All @@ -111,26 +115,51 @@ async def follow(
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-put-follow.html>`_
:param index: The name of the follower index
:param leader_index:
:param max_outstanding_read_requests:
:param max_outstanding_write_requests:
:param max_read_request_operation_count:
:param max_read_request_size:
:param max_retry_delay:
:param max_write_buffer_count:
:param max_write_buffer_size:
:param max_write_request_operation_count:
:param max_write_request_size:
:param read_poll_timeout:
:param remote_cluster:
:param wait_for_active_shards: Sets the number of shard copies that must be active
before returning. Defaults to 0. Set to `all` for all shard copies, otherwise
set to any non-negative value less than or equal to the total number of copies
for the shard (number of replicas + 1)
:param index: The name of the follower index.
:param leader_index: The name of the index in the leader cluster to follow.
:param remote_cluster: The remote cluster containing the leader index.
:param data_stream_name: If the leader index is part of a data stream, the name
to which the local data stream for the followed index should be renamed.
:param max_outstanding_read_requests: The maximum number of outstanding reads
requests from the remote cluster.
:param max_outstanding_write_requests: The maximum number of outstanding write
requests on the follower.
:param max_read_request_operation_count: The maximum number of operations to
pull per read from the remote cluster.
:param max_read_request_size: The maximum size in bytes of per read of a batch
of operations pulled from the remote cluster.
:param max_retry_delay: The maximum time to wait before retrying an operation
that failed exceptionally. An exponential backoff strategy is employed when
retrying.
:param max_write_buffer_count: The maximum number of operations that can be queued
for writing. When this limit is reached, reads from the remote cluster will
be deferred until the number of queued operations goes below the limit.
:param max_write_buffer_size: The maximum total bytes of operations that can
be queued for writing. When this limit is reached, reads from the remote
cluster will be deferred until the total bytes of queued operations goes
below the limit.
:param max_write_request_operation_count: The maximum number of operations per
bulk write request executed on the follower.
:param max_write_request_size: The maximum total bytes of operations per bulk
write request executed on the follower.
:param read_poll_timeout: The maximum time to wait for new operations on the
remote cluster when the follower index is synchronized with the leader index.
When the timeout has elapsed, the poll for operations will return to the
follower so that it can update some statistics. Then the follower will immediately
attempt to read from the leader again.
:param settings: Settings to override from the leader index.
:param wait_for_active_shards: Specifies the number of shards to wait on being
active before responding. This defaults to waiting on none of the shards
to be active. A shard must be restored from the leader index before being
active. Restoring a follower shard requires transferring all the remote Lucene
segment files to the follower index.
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'index'")
if leader_index is None and body is None:
raise ValueError("Empty value passed for parameter 'leader_index'")
if remote_cluster is None and body is None:
raise ValueError("Empty value passed for parameter 'remote_cluster'")
__path_parts: t.Dict[str, str] = {"index": _quote(index)}
__path = f'/{__path_parts["index"]}/_ccr/follow'
__query: t.Dict[str, t.Any] = {}
Expand All @@ -148,6 +177,10 @@ async def follow(
if not __body:
if leader_index is not None:
__body["leader_index"] = leader_index
if remote_cluster is not None:
__body["remote_cluster"] = remote_cluster
if data_stream_name is not None:
__body["data_stream_name"] = data_stream_name
if max_outstanding_read_requests is not None:
__body["max_outstanding_read_requests"] = max_outstanding_read_requests
if max_outstanding_write_requests is not None:
Expand All @@ -174,8 +207,8 @@ async def follow(
__body["max_write_request_size"] = max_write_request_size
if read_poll_timeout is not None:
__body["read_poll_timeout"] = read_poll_timeout
if remote_cluster is not None:
__body["remote_cluster"] = remote_cluster
if settings is not None:
__body["settings"] = settings
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"PUT",
Expand Down
Loading

0 comments on commit 94573cf

Please sign in to comment.