Skip to content

Auto-generated code for main #2855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 35 additions & 22 deletions elasticsearch/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5884,7 +5884,20 @@ async def terms_enum(
)

@_rewrite_parameters(
body_fields=("doc", "filter", "per_field_analyzer"),
body_fields=(
"doc",
"field_statistics",
"fields",
"filter",
"offsets",
"payloads",
"per_field_analyzer",
"positions",
"routing",
"term_statistics",
"version",
"version_type",
),
)
async def termvectors(
self,
Expand Down Expand Up @@ -5961,9 +5974,9 @@ async def termvectors(
(the sum of document frequencies for all terms in this field). * The sum
of total term frequencies (the sum of total term frequencies of each term
in this field).
:param fields: A comma-separated list or wildcard expressions of fields to include
in the statistics. It is used as the default list unless a specific field
list is provided in the `completion_fields` or `fielddata_fields` parameters.
:param fields: A list of fields to include in the statistics. It is used as the
default list unless a specific field list is provided in the `completion_fields`
or `fielddata_fields` parameters.
:param filter: Filter terms based on their tf-idf scores. This could be useful
in order find out a good characteristic vector of a document. This feature
works in a similar manner to the second phase of the More Like This Query.
Expand Down Expand Up @@ -6001,41 +6014,41 @@ async def termvectors(
__body: t.Dict[str, t.Any] = body if body is not None else {}
if error_trace is not None:
__query["error_trace"] = error_trace
if field_statistics is not None:
__query["field_statistics"] = field_statistics
if fields is not None:
__query["fields"] = fields
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if offsets is not None:
__query["offsets"] = offsets
if payloads is not None:
__query["payloads"] = payloads
if positions is not None:
__query["positions"] = positions
if preference is not None:
__query["preference"] = preference
if pretty is not None:
__query["pretty"] = pretty
if realtime is not None:
__query["realtime"] = realtime
if routing is not None:
__query["routing"] = routing
if term_statistics is not None:
__query["term_statistics"] = term_statistics
if version is not None:
__query["version"] = version
if version_type is not None:
__query["version_type"] = version_type
if not __body:
if doc is not None:
__body["doc"] = doc
if field_statistics is not None:
__body["field_statistics"] = field_statistics
if fields is not None:
__body["fields"] = fields
if filter is not None:
__body["filter"] = filter
if offsets is not None:
__body["offsets"] = offsets
if payloads is not None:
__body["payloads"] = payloads
if per_field_analyzer is not None:
__body["per_field_analyzer"] = per_field_analyzer
if positions is not None:
__body["positions"] = positions
if routing is not None:
__body["routing"] = routing
if term_statistics is not None:
__body["term_statistics"] = term_statistics
if version is not None:
__body["version"] = version
if version_type is not None:
__body["version_type"] = version_type
if not __body:
__body = None # type: ignore[assignment]
__headers = {"accept": "application/json"}
Expand Down
17 changes: 15 additions & 2 deletions elasticsearch/_async/client/esql.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ class EsqlClient(NamespacedClient):
"params",
"profile",
"tables",
"wait_for_completion_timeout",
),
ignore_deprecated_options={"params"},
)
async def async_query(
self,
*,
query: t.Optional[str] = None,
allow_partial_results: t.Optional[bool] = None,
columnar: t.Optional[bool] = None,
delimiter: t.Optional[str] = None,
drop_null_columns: t.Optional[bool] = None,
Expand Down Expand Up @@ -84,6 +86,9 @@ async def async_query(

:param query: The ES|QL query API accepts an ES|QL query string in the query
parameter, runs it, and returns the results.
:param allow_partial_results: If `true`, partial results will be returned if
there are shard failures, but the query can continue to execute on other
clusters and shards.
:param columnar: By default, ES|QL returns results as rows. For example, FROM
returns each individual document as one row. For the JSON, YAML, CBOR and
smile formats, ES|QL can return the results in a columnar fashion where one
Expand Down Expand Up @@ -132,6 +137,8 @@ async def async_query(
__path = "/_query/async"
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if allow_partial_results is not None:
__query["allow_partial_results"] = allow_partial_results
if delimiter is not None:
__query["delimiter"] = delimiter
if drop_null_columns is not None:
Expand All @@ -150,8 +157,6 @@ async def async_query(
__query["keep_on_completion"] = keep_on_completion
if pretty is not None:
__query["pretty"] = pretty
if wait_for_completion_timeout is not None:
__query["wait_for_completion_timeout"] = wait_for_completion_timeout
if not __body:
if query is not None:
__body["query"] = query
Expand All @@ -169,6 +174,8 @@ async def async_query(
__body["profile"] = profile
if tables is not None:
__body["tables"] = tables
if wait_for_completion_timeout is not None:
__body["wait_for_completion_timeout"] = wait_for_completion_timeout
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"POST",
Expand Down Expand Up @@ -376,6 +383,7 @@ async def query(
self,
*,
query: t.Optional[str] = None,
allow_partial_results: t.Optional[bool] = None,
columnar: t.Optional[bool] = None,
delimiter: t.Optional[str] = None,
drop_null_columns: t.Optional[bool] = None,
Expand Down Expand Up @@ -412,6 +420,9 @@ async def query(

:param query: The ES|QL query API accepts an ES|QL query string in the query
parameter, runs it, and returns the results.
:param allow_partial_results: If `true`, partial results will be returned if
there are shard failures, but the query can continue to execute on other
clusters and shards.
:param columnar: By default, ES|QL returns results as rows. For example, FROM
returns each individual document as one row. For the JSON, YAML, CBOR and
smile formats, ES|QL can return the results in a columnar fashion where one
Expand Down Expand Up @@ -446,6 +457,8 @@ async def query(
__path = "/_query"
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if allow_partial_results is not None:
__query["allow_partial_results"] = allow_partial_results
if delimiter is not None:
__query["delimiter"] = delimiter
if drop_null_columns is not None:
Expand Down
51 changes: 42 additions & 9 deletions elasticsearch/_async/client/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,9 @@ async def exists_index_template(
name: str,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
flat_settings: t.Optional[bool] = None,
human: t.Optional[bool] = None,
local: t.Optional[bool] = None,
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
pretty: t.Optional[bool] = None,
) -> HeadApiResponse:
Expand All @@ -1637,6 +1639,10 @@ async def exists_index_template(

:param name: Comma-separated list of index template names used to limit the request.
Wildcard (*) expressions are supported.
:param flat_settings: If true, returns settings in flat format.
:param local: If true, the request retrieves information from the local node
only. Defaults to false, which means information is retrieved from the master
node.
: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.
Expand All @@ -1650,8 +1656,12 @@ async def exists_index_template(
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if flat_settings is not None:
__query["flat_settings"] = flat_settings
if human is not None:
__query["human"] = human
if local is not None:
__query["local"] = local
if master_timeout is not None:
__query["master_timeout"] = master_timeout
if pretty is not None:
Expand Down Expand Up @@ -1801,9 +1811,6 @@ async def field_usage_stats(
human: t.Optional[bool] = None,
ignore_unavailable: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
wait_for_active_shards: t.Optional[
t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
] = None,
) -> ObjectApiResponse[t.Any]:
"""
.. raw:: html
Expand Down Expand Up @@ -1833,9 +1840,6 @@ async def field_usage_stats(
in the statistics.
:param ignore_unavailable: If `true`, missing or closed indices are not included
in the response.
:param wait_for_active_shards: The number of shard copies that must be active
before proceeding with the operation. Set to all or any positive integer
up to the total number of shards in the index (`number_of_replicas+1`).
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'index'")
Expand All @@ -1858,8 +1862,6 @@ async def field_usage_stats(
__query["ignore_unavailable"] = ignore_unavailable
if pretty is not None:
__query["pretty"] = pretty
if wait_for_active_shards is not None:
__query["wait_for_active_shards"] = wait_for_active_shards
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"GET",
Expand Down Expand Up @@ -3835,6 +3837,7 @@ async def put_settings(
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
preserve_existing: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
reopen: t.Optional[bool] = None,
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Expand Down Expand Up @@ -3877,6 +3880,9 @@ async def put_settings(
no response is received before the timeout expires, the request fails and
returns an error.
:param preserve_existing: If `true`, existing index settings remain unchanged.
:param reopen: Whether to close and reopen the index to apply non-dynamic settings.
If set to `true` the indices to which the settings are being applied will
be closed temporarily and then reopened in order to apply the changes.
:param timeout: Period to wait for a response. If no response is received before
the timeout expires, the request fails and returns an error.
"""
Expand Down Expand Up @@ -3914,6 +3920,8 @@ async def put_settings(
__query["preserve_existing"] = preserve_existing
if pretty is not None:
__query["pretty"] = pretty
if reopen is not None:
__query["reopen"] = reopen
if timeout is not None:
__query["timeout"] = timeout
__body = settings if settings is not None else body
Expand Down Expand Up @@ -3981,7 +3989,7 @@ async def put_template(

:param name: The name of the template
:param aliases: Aliases for the index.
:param cause:
:param cause: User defined reason for creating/updating the index template
:param create: If true, this request cannot replace or update existing index
templates.
:param index_patterns: Array of wildcard expressions used to match the names
Expand Down Expand Up @@ -4219,6 +4227,7 @@ async def reload_search_analyzers(
human: t.Optional[bool] = None,
ignore_unavailable: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
resource: t.Optional[str] = None,
) -> ObjectApiResponse[t.Any]:
"""
.. raw:: html
Expand Down Expand Up @@ -4246,6 +4255,7 @@ async def reload_search_analyzers(
that are open, closed or both.
:param ignore_unavailable: Whether specified concrete indices should be ignored
when unavailable (missing or closed)
:param resource: Changed resource to reload analyzers from if applicable
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'index'")
Expand All @@ -4266,6 +4276,8 @@ async def reload_search_analyzers(
__query["ignore_unavailable"] = ignore_unavailable
if pretty is not None:
__query["pretty"] = pretty
if resource is not None:
__query["resource"] = resource
__headers = {"accept": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"POST",
Expand Down Expand Up @@ -4502,6 +4514,7 @@ async def rollover(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
lazy: t.Optional[bool] = None,
mappings: t.Optional[t.Mapping[str, t.Any]] = None,
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
pretty: t.Optional[bool] = None,
Expand Down Expand Up @@ -4558,6 +4571,9 @@ async def rollover(
conditions are satisfied.
:param dry_run: If `true`, checks whether the current index satisfies the specified
conditions but does not perform a rollover.
:param lazy: If set to true, the rollover action will only mark a data stream
to signal that it needs to be rolled over at the next write. Only allowed
on data streams.
:param mappings: Mapping for fields in the index. If specified, this mapping
can include field names, field data types, and mapping paramaters.
:param master_timeout: Period to wait for a connection to the master node. If
Expand Down Expand Up @@ -4592,6 +4608,8 @@ async def rollover(
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if lazy is not None:
__query["lazy"] = lazy
if master_timeout is not None:
__query["master_timeout"] = master_timeout
if pretty is not None:
Expand Down Expand Up @@ -4908,6 +4926,8 @@ async def simulate_index_template(
self,
*,
name: str,
cause: t.Optional[str] = None,
create: t.Optional[bool] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
Expand All @@ -4925,6 +4945,10 @@ async def simulate_index_template(
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-simulate-index-template>`_

:param name: Name of the index to simulate
:param cause: User defined reason for dry-run creating the new template for simulation
purposes
:param create: Whether the index template we optionally defined in the body should
only be dry-run added if new or can also replace an existing one
:param include_defaults: If true, returns all relevant default configurations
for the index template.
:param master_timeout: Period to wait for a connection to the master node. If
Expand All @@ -4936,6 +4960,10 @@ async def simulate_index_template(
__path_parts: t.Dict[str, str] = {"name": _quote(name)}
__path = f'/_index_template/_simulate_index/{__path_parts["name"]}'
__query: t.Dict[str, t.Any] = {}
if cause is not None:
__query["cause"] = cause
if create is not None:
__query["create"] = create
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
Expand Down Expand Up @@ -4978,6 +5006,7 @@ async def simulate_template(
*,
name: t.Optional[str] = None,
allow_auto_create: t.Optional[bool] = None,
cause: t.Optional[str] = None,
composed_of: t.Optional[t.Sequence[str]] = None,
create: t.Optional[bool] = None,
data_stream: t.Optional[t.Mapping[str, t.Any]] = None,
Expand Down Expand Up @@ -5014,6 +5043,8 @@ async def simulate_template(
via `actions.auto_create_index`. If set to `false`, then indices or data
streams matching the template must always be explicitly created, and may
never be automatically created.
:param cause: User defined reason for dry-run creating the new template for simulation
purposes
:param composed_of: An ordered list of component template names. Component templates
are merged in the order specified, meaning that the last component template
specified has the highest precedence.
Expand Down Expand Up @@ -5058,6 +5089,8 @@ async def simulate_template(
__path = "/_index_template/_simulate"
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if cause is not None:
__query["cause"] = cause
if create is not None:
__query["create"] = create
if error_trace is not None:
Expand Down
Loading