Skip to content

Commit

Permalink
Auto-generated code for 8.x (#2719)
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin authored Dec 10, 2024
1 parent f69cb3d commit 22377c0
Show file tree
Hide file tree
Showing 32 changed files with 604 additions and 258 deletions.
30 changes: 28 additions & 2 deletions elasticsearch/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ async def count(
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Returns number of documents matching a query.
Count search results. Get the number of documents matching a query.
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/search-count.html>`_
Expand Down Expand Up @@ -2274,7 +2274,26 @@ async def health_report(
verbose: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Returns the health of the cluster.
Get the cluster health. Get a report with the health status of an Elasticsearch
cluster. The report contains a list of indicators that compose Elasticsearch
functionality. Each indicator has a health status of: green, unknown, yellow
or red. The indicator will provide an explanation and metadata describing the
reason for its current health status. The cluster’s status is controlled by the
worst indicator status. In the event that an indicator’s status is non-green,
a list of impacts may be present in the indicator result which detail the functionalities
that are negatively affected by the health issue. Each impact carries with it
a severity level, an area of the system that is affected, and a simple description
of the impact on the system. Some health indicators can determine the root cause
of a health problem and prescribe a set of steps that can be performed in order
to improve the health of the system. The root cause and remediation steps are
encapsulated in a diagnosis. A diagnosis contains a cause detailing a root cause
analysis, an action containing a brief description of the steps to take to fix
the problem, the list of affected resources (if applicable), and a detailed step-by-step
troubleshooting guide to fix the diagnosed problem. NOTE: The health indicators
perform root cause analysis of non-green health statuses. This can be computationally
expensive when called frequently. When setting up automated polling of the API
for health status, set verbose to false to disable the more expensive analysis
logic.
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/health-api.html>`_
Expand Down Expand Up @@ -3079,6 +3098,7 @@ async def open_point_in_time(
*,
index: t.Union[str, t.Sequence[str]],
keep_alive: t.Union[str, t.Literal[-1], t.Literal[0]],
allow_partial_search_results: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
expand_wildcards: t.Optional[
t.Union[
Expand Down Expand Up @@ -3113,6 +3133,10 @@ async def open_point_in_time(
:param index: A comma-separated list of index names to open point in time; use
`_all` or empty string to perform the operation on all indices
:param keep_alive: Extends the time to live of the corresponding point in time.
:param allow_partial_search_results: If `false`, creating a point in time request
when a shard is missing or unavailable will throw an exception. If `true`,
the point in time will contain all the shards that are available at the time
of the request.
:param expand_wildcards: Type of index that wildcard patterns can match. If the
request can target data streams, this argument determines whether wildcard
expressions match hidden data streams. Supports comma-separated values, such
Expand All @@ -3135,6 +3159,8 @@ async def open_point_in_time(
__body: t.Dict[str, t.Any] = body if body is not None else {}
if keep_alive is not None:
__query["keep_alive"] = keep_alive
if allow_partial_search_results is not None:
__query["allow_partial_search_results"] = allow_partial_search_results
if error_trace is not None:
__query["error_trace"] = error_trace
if expand_wildcards is not None:
Expand Down
26 changes: 8 additions & 18 deletions elasticsearch/_async/client/async_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ async def status(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Expand All @@ -156,6 +157,9 @@ async def status(
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/async-search.html>`_
:param id: A unique identifier for the async search.
:param keep_alive: Specifies how long the async search needs to be available.
Ongoing async searches and any saved search results are deleted after this
period.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'id'")
Expand All @@ -168,6 +172,8 @@ async def status(
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if keep_alive is not None:
__query["keep_alive"] = keep_alive
if pretty is not None:
__query["pretty"] = pretty
__headers = {"accept": "application/json"}
Expand Down Expand Up @@ -258,7 +264,6 @@ async def submit(
ignore_throttled: t.Optional[bool] = None,
ignore_unavailable: t.Optional[bool] = None,
indices_boost: t.Optional[t.Sequence[t.Mapping[str, float]]] = None,
keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
keep_on_completion: t.Optional[bool] = None,
knn: t.Optional[
t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
Expand All @@ -269,7 +274,6 @@ async def submit(
min_score: t.Optional[float] = None,
pit: t.Optional[t.Mapping[str, t.Any]] = None,
post_filter: t.Optional[t.Mapping[str, t.Any]] = None,
pre_filter_shard_size: t.Optional[int] = None,
preference: t.Optional[str] = None,
pretty: t.Optional[bool] = None,
profile: t.Optional[bool] = None,
Expand All @@ -283,7 +287,6 @@ async def submit(
routing: t.Optional[str] = None,
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
search_after: t.Optional[
t.Sequence[t.Union[None, bool, float, int, str, t.Any]]
] = None,
Expand Down Expand Up @@ -376,9 +379,6 @@ async def submit(
:param ignore_unavailable: Whether specified concrete indices should be ignored
when unavailable (missing or closed)
:param indices_boost: Boosts the _score of documents from specified indices.
:param keep_alive: Specifies how long the async search needs to be available.
Ongoing async searches and any saved search results are deleted after this
period.
:param keep_on_completion: If `true`, results are stored for later retrieval
when the search completes within the `wait_for_completion_timeout`.
:param knn: Defines the approximate kNN search to run.
Expand All @@ -394,10 +394,6 @@ async def submit(
:param pit: Limits the search to a point in time (PIT). If you provide a PIT,
you cannot specify an <index> in the request path.
:param post_filter:
:param pre_filter_shard_size: The default value cannot be changed, which enforces
the execution of a pre-filter roundtrip to retrieve statistics from each
shard so that the ones that surely don’t hold any document matching the query
get skipped.
:param preference: Specify the node or shard the operation should be performed
on (default: random)
:param profile:
Expand All @@ -406,13 +402,13 @@ async def submit(
:param request_cache: Specify if request cache should be used for this request
or not, defaults to true
:param rescore:
:param rest_total_hits_as_int:
:param rest_total_hits_as_int: Indicates whether hits.total should be rendered
as an integer or an object in the rest search response
:param routing: A comma-separated list of specific routing values
:param runtime_mappings: Defines one or more runtime fields in the search request.
These fields take precedence over mapped fields with the same name.
:param script_fields: Retrieve a script evaluation (based on different fields)
for each hit.
:param scroll:
:param search_after:
:param search_type: Search operation type
:param seq_no_primary_term: If true, returns sequence number and primary term
Expand Down Expand Up @@ -509,8 +505,6 @@ async def submit(
__query["ignore_throttled"] = ignore_throttled
if ignore_unavailable is not None:
__query["ignore_unavailable"] = ignore_unavailable
if keep_alive is not None:
__query["keep_alive"] = keep_alive
if keep_on_completion is not None:
__query["keep_on_completion"] = keep_on_completion
if lenient is not None:
Expand All @@ -519,8 +513,6 @@ async def submit(
__query["max_concurrent_shard_requests"] = max_concurrent_shard_requests
if min_compatible_shard_node is not None:
__query["min_compatible_shard_node"] = min_compatible_shard_node
if pre_filter_shard_size is not None:
__query["pre_filter_shard_size"] = pre_filter_shard_size
if preference is not None:
__query["preference"] = preference
if pretty is not None:
Expand All @@ -533,8 +525,6 @@ async def submit(
__query["rest_total_hits_as_int"] = rest_total_hits_as_int
if routing is not None:
__query["routing"] = routing
if scroll is not None:
__query["scroll"] = scroll
if search_type is not None:
__query["search_type"] = search_type
if source_excludes is not None:
Expand Down
35 changes: 35 additions & 0 deletions elasticsearch/_async/client/autoscaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ async def delete_autoscaling_policy(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
pretty: t.Optional[bool] = None,
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Delete an autoscaling policy. NOTE: This feature is designed for indirect use
Expand All @@ -43,6 +45,11 @@ async def delete_autoscaling_policy(
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/autoscaling-delete-autoscaling-policy.html>`_
:param name: the name of the autoscaling policy
:param master_timeout: Period to wait for a connection to the master node. If
no response is received before the timeout expires, the request fails and
returns an error.
:param timeout: Period to wait for a response. If no response is received before
the timeout expires, the request fails and returns an error.
"""
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'name'")
Expand All @@ -55,8 +62,12 @@ async def delete_autoscaling_policy(
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if master_timeout is not None:
__query["master_timeout"] = master_timeout
if pretty is not None:
__query["pretty"] = pretty
if timeout is not None:
__query["timeout"] = timeout
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"DELETE",
Expand All @@ -74,6 +85,7 @@ async def get_autoscaling_capacity(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Expand All @@ -91,6 +103,10 @@ async def get_autoscaling_capacity(
use this information to make autoscaling decisions.
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/autoscaling-get-autoscaling-capacity.html>`_
:param master_timeout: Period to wait for a connection to the master node. If
no response is received before the timeout expires, the request fails and
returns an error.
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_autoscaling/capacity"
Expand All @@ -101,6 +117,8 @@ async def get_autoscaling_capacity(
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if master_timeout is not None:
__query["master_timeout"] = master_timeout
if pretty is not None:
__query["pretty"] = pretty
__headers = {"accept": "application/json"}
Expand All @@ -121,6 +139,7 @@ async def get_autoscaling_policy(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
pretty: t.Optional[bool] = None,
) -> ObjectApiResponse[t.Any]:
"""
Expand All @@ -131,6 +150,9 @@ async def get_autoscaling_policy(
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/autoscaling-get-autoscaling-capacity.html>`_
:param name: the name of the autoscaling policy
:param master_timeout: Period to wait for a connection to the master node. If
no response is received before the timeout expires, the request fails and
returns an error.
"""
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'name'")
Expand All @@ -143,6 +165,8 @@ async def get_autoscaling_policy(
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if master_timeout is not None:
__query["master_timeout"] = master_timeout
if pretty is not None:
__query["pretty"] = pretty
__headers = {"accept": "application/json"}
Expand All @@ -167,7 +191,9 @@ async def put_autoscaling_policy(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
pretty: t.Optional[bool] = None,
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Create or update an autoscaling policy. NOTE: This feature is designed for indirect
Expand All @@ -178,6 +204,11 @@ async def put_autoscaling_policy(
:param name: the name of the autoscaling policy
:param policy:
:param master_timeout: Period to wait for a connection to the master node. If
no response is received before the timeout expires, the request fails and
returns an error.
:param timeout: Period to wait for a response. If no response is received before
the timeout expires, the request fails and returns an error.
"""
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'name'")
Expand All @@ -196,8 +227,12 @@ async def put_autoscaling_policy(
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if master_timeout is not None:
__query["master_timeout"] = master_timeout
if pretty is not None:
__query["pretty"] = pretty
if timeout is not None:
__query["timeout"] = timeout
__body = policy if policy is not None else body
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
Expand Down
Loading

0 comments on commit 22377c0

Please sign in to comment.