From 66a9d87149568a827a82612c2caff8c32c95ae20 Mon Sep 17 00:00:00 2001
From: Elastic Machine
Date: Mon, 1 Sep 2025 06:02:51 +0000
Subject: [PATCH] Auto-generated API code
---
elasticsearch/_async/client/__init__.py | 25 +-
elasticsearch/_async/client/cat.py | 134 ++++++++++-
elasticsearch/_async/client/cluster.py | 9 +-
elasticsearch/_async/client/esql.py | 23 +-
elasticsearch/_async/client/indices.py | 10 +-
elasticsearch/_async/client/inference.py | 283 ++++++++++++++++++++++-
elasticsearch/_async/client/simulate.py | 8 +
elasticsearch/_async/client/sql.py | 2 +-
elasticsearch/_async/client/transform.py | 60 +++++
elasticsearch/_sync/client/__init__.py | 25 +-
elasticsearch/_sync/client/cat.py | 134 ++++++++++-
elasticsearch/_sync/client/cluster.py | 9 +-
elasticsearch/_sync/client/esql.py | 23 +-
elasticsearch/_sync/client/indices.py | 10 +-
elasticsearch/_sync/client/inference.py | 283 ++++++++++++++++++++++-
elasticsearch/_sync/client/simulate.py | 8 +
elasticsearch/_sync/client/sql.py | 2 +-
elasticsearch/_sync/client/transform.py | 60 +++++
elasticsearch/dsl/types.py | 71 +++---
19 files changed, 1081 insertions(+), 98 deletions(-)
diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py
index 0874e120f..e4fee64cc 100644
--- a/elasticsearch/_async/client/__init__.py
+++ b/elasticsearch/_async/client/__init__.py
@@ -608,6 +608,7 @@ async def bulk(
JavaScript: Check out client.helpers.*
.NET: Check out BulkAllObservable
PHP: Check out bulk indexing.
+ Ruby: Check out Elasticsearch::Helpers::BulkHelper
Submitting bulk requests with cURL
If you're providing text file input to curl
, you must use the --data-binary
flag instead of plain -d
.
@@ -1326,7 +1327,7 @@ async def delete(
)
@_rewrite_parameters(
- body_fields=("max_docs", "query", "slice"),
+ body_fields=("max_docs", "query", "slice", "sort"),
parameter_aliases={"from": "from_"},
)
async def delete_by_query(
@@ -1370,7 +1371,12 @@ async def delete_by_query(
] = None,
slice: t.Optional[t.Mapping[str, t.Any]] = None,
slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
- sort: t.Optional[t.Sequence[str]] = None,
+ sort: t.Optional[
+ t.Union[
+ t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
+ t.Union[str, t.Mapping[str, t.Any]],
+ ]
+ ] = None,
stats: t.Optional[t.Sequence[str]] = None,
terminate_after: t.Optional[int] = None,
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -1502,7 +1508,7 @@ async def delete_by_query(
:param slice: Slice the request manually using the provided slice ID and total
number of slices.
:param slices: The number of slices this task should be divided into.
- :param sort: A comma-separated list of `:` pairs.
+ :param sort: A sort object that specifies the order of deleted documents.
:param stats: The specific `tag` of the request for logging and statistical purposes.
:param terminate_after: The maximum number of documents to collect for each shard.
If a query reaches this limit, Elasticsearch terminates the query early.
@@ -1592,8 +1598,6 @@ async def delete_by_query(
__query["search_type"] = search_type
if slices is not None:
__query["slices"] = slices
- if sort is not None:
- __query["sort"] = sort
if stats is not None:
__query["stats"] = stats
if terminate_after is not None:
@@ -1613,6 +1617,8 @@ async def delete_by_query(
__body["query"] = query
if slice is not None:
__body["slice"] = slice
+ if sort is not None:
+ __body["sort"] = sort
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"POST",
@@ -3875,6 +3881,13 @@ async def reindex(
In this case, the response includes a count of the version conflicts that were encountered.
Note that the handling of other error types is unaffected by the conflicts
property.
Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs
until it has successfully indexed max_docs
documents into the target or it has gone through every document in the source query.
+ It's recommended to reindex on indices with a green status. Reindexing can fail when a node shuts down or crashes.
+
+ - When requested with
wait_for_completion=true
(default), the request fails if the node shuts down.
+ - When requested with
wait_for_completion=false
, a task id is returned, for use with the task management APIs. The task may disappear or fail if the node shuts down.
+ When retrying a failed reindex operation, it might be necessary to set conflicts=proceed
or to first delete the partial destination index.
+ Additionally, dry runs, checking disk space, and fetching index recovery information can help address the root cause.
+
Refer to the linked documentation for examples of how to reindex documents.
@@ -5659,7 +5672,7 @@ async def termvectors(
doc: t.Optional[t.Mapping[str, t.Any]] = None,
error_trace: t.Optional[bool] = None,
field_statistics: t.Optional[bool] = None,
- fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ fields: t.Optional[t.Sequence[str]] = None,
filter: t.Optional[t.Mapping[str, t.Any]] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
diff --git a/elasticsearch/_async/client/cat.py b/elasticsearch/_async/client/cat.py
index 148ed721f..4a870f6ab 100644
--- a/elasticsearch/_async/client/cat.py
+++ b/elasticsearch/_async/client/cat.py
@@ -47,7 +47,34 @@ async def aliases(
] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ h: t.Optional[
+ t.Union[
+ t.Sequence[
+ t.Union[
+ str,
+ t.Literal[
+ "alias",
+ "filter",
+ "index",
+ "is_write_index",
+ "routing.index",
+ "routing.search",
+ ],
+ ]
+ ],
+ t.Union[
+ str,
+ t.Literal[
+ "alias",
+ "filter",
+ "index",
+ "is_write_index",
+ "routing.index",
+ "routing.search",
+ ],
+ ],
+ ]
+ ] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -74,7 +101,8 @@ async def aliases(
values, such as `open,hidden`.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
- :param h: List of columns to appear in the response. Supports simple wildcards.
+ :param h: A comma-separated list of columns names to display. It supports simple
+ wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param master_timeout: The period to wait for a connection to the master node.
@@ -137,7 +165,48 @@ async def allocation(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ h: t.Optional[
+ t.Union[
+ t.Sequence[
+ t.Union[
+ str,
+ t.Literal[
+ "disk.avail",
+ "disk.indices",
+ "disk.indices.forecast",
+ "disk.percent",
+ "disk.total",
+ "disk.used",
+ "host",
+ "ip",
+ "node",
+ "node.role",
+ "shards",
+ "shards.undesired",
+ "write_load.forecast",
+ ],
+ ]
+ ],
+ t.Union[
+ str,
+ t.Literal[
+ "disk.avail",
+ "disk.indices",
+ "disk.indices.forecast",
+ "disk.percent",
+ "disk.total",
+ "disk.used",
+ "host",
+ "ip",
+ "node",
+ "node.role",
+ "shards",
+ "shards.undesired",
+ "write_load.forecast",
+ ],
+ ],
+ ]
+ ] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
local: t.Optional[bool] = None,
@@ -161,7 +230,8 @@ async def allocation(
:param bytes: The unit used to display byte values.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
- :param h: List of columns to appear in the response. Supports simple wildcards.
+ :param h: A comma-separated list of columns names to display. It supports simple
+ wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param local: If `true`, the request computes the list of selected nodes from
@@ -224,7 +294,36 @@ async def component_templates(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ h: t.Optional[
+ t.Union[
+ t.Sequence[
+ t.Union[
+ str,
+ t.Literal[
+ "alias_count",
+ "included_in",
+ "mapping_count",
+ "metadata_count",
+ "name",
+ "settings_count",
+ "version",
+ ],
+ ]
+ ],
+ t.Union[
+ str,
+ t.Literal[
+ "alias_count",
+ "included_in",
+ "mapping_count",
+ "metadata_count",
+ "name",
+ "settings_count",
+ "version",
+ ],
+ ],
+ ]
+ ] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
local: t.Optional[bool] = None,
@@ -249,7 +348,8 @@ async def component_templates(
If it is omitted, all component templates are returned.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
- :param h: List of columns to appear in the response. Supports simple wildcards.
+ :param h: A comma-separated list of columns names to display. It supports simple
+ wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param local: If `true`, the request computes the list of selected nodes from
@@ -310,7 +410,12 @@ async def count(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ h: t.Optional[
+ t.Union[
+ t.Sequence[t.Union[str, t.Literal["count", "epoch", "timestamp"]]],
+ t.Union[str, t.Literal["count", "epoch", "timestamp"]],
+ ]
+ ] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
@@ -334,7 +439,8 @@ async def count(
and indices, omit this parameter or use `*` or `_all`.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
- :param h: List of columns to appear in the response. Supports simple wildcards.
+ :param h: A comma-separated list of columns names to display. It supports simple
+ wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param s: List of columns that determine how the table should be sorted. Sorting
@@ -389,7 +495,14 @@ async def fielddata(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ h: t.Optional[
+ t.Union[
+ t.Sequence[
+ t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]]
+ ],
+ t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]],
+ ]
+ ] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
@@ -412,7 +525,8 @@ async def fielddata(
:param bytes: The unit used to display byte values.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
- :param h: List of columns to appear in the response. Supports simple wildcards.
+ :param h: A comma-separated list of columns names to display. It supports simple
+ wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param s: List of columns that determine how the table should be sorted. Sorting
diff --git a/elasticsearch/_async/client/cluster.py b/elasticsearch/_async/client/cluster.py
index 91956f7c4..a6efa8529 100644
--- a/elasticsearch/_async/client/cluster.py
+++ b/elasticsearch/_async/client/cluster.py
@@ -374,8 +374,13 @@ async def get_settings(
``_
:param flat_settings: If `true`, returns settings in flat format.
- :param include_defaults: If `true`, returns default cluster settings from the
- local node.
+ :param include_defaults: If `true`, also returns default values for all other
+ cluster settings, reflecting the values in the `elasticsearch.yml` file of
+ one of the nodes in the cluster. If the nodes in your cluster do not all
+ have the same values in their `elasticsearch.yml` config files then the values
+ returned by this API may vary from invocation to invocation and may not reflect
+ the values that Elasticsearch uses in all situations. Use the `GET _nodes/settings`
+ API to fetch the settings for each individual node in your cluster.
: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.
diff --git a/elasticsearch/_async/client/esql.py b/elasticsearch/_async/client/esql.py
index 9999f1db1..6bf5a2ef8 100644
--- a/elasticsearch/_async/client/esql.py
+++ b/elasticsearch/_async/client/esql.py
@@ -50,7 +50,7 @@ class EsqlClient(NamespacedClient):
async def async_query(
self,
*,
- query: t.Optional[str] = None,
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
allow_partial_results: t.Optional[bool] = None,
columnar: t.Optional[bool] = None,
delimiter: t.Optional[str] = None,
@@ -111,7 +111,12 @@ async def async_query(
which has the name of all the columns.
:param filter: Specify a Query DSL query in the filter parameter to filter the
set of documents that an ES|QL query runs on.
- :param format: A short version of the Accept header, for example `json` or `yaml`.
+ :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
+ `tsv`, and `txt` formats will return results in a tabular format, excluding
+ other metadata fields from the response. For async requests, nothing will
+ be returned if the async query doesn't finish within the timeout. The query
+ ID and running status are available in the `X-Elasticsearch-Async-Id` and
+ `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively.
:param include_ccs_metadata: When set to `true` and performing a cross-cluster
query, the response will include an extra `_clusters` object with information
about the clusters that participated in the search along with info such as
@@ -165,7 +170,7 @@ async def async_query(
__query["pretty"] = pretty
if not __body:
if query is not None:
- __body["query"] = query
+ __body["query"] = str(query)
if columnar is not None:
__body["columnar"] = columnar
if filter is not None:
@@ -405,6 +410,8 @@ async def get_query(
Returns an object extended information about a running ES|QL query.
+ ``_
+
:param id: The query ID
"""
if id in SKIP_IN_PATH:
@@ -446,6 +453,8 @@ async def list_queries(
Get running ES|QL queries information.
Returns an object containing IDs and other information about the running ES|QL queries.
+
+ ``_
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_query/queries"
@@ -484,7 +493,7 @@ async def list_queries(
async def query(
self,
*,
- query: t.Optional[str] = None,
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
allow_partial_results: t.Optional[bool] = None,
columnar: t.Optional[bool] = None,
delimiter: t.Optional[str] = None,
@@ -539,7 +548,9 @@ async def query(
`all_columns` which has the name of all columns.
:param filter: Specify a Query DSL query in the filter parameter to filter the
set of documents that an ES|QL query runs on.
- :param format: A short version of the Accept header, e.g. json, yaml.
+ :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
+ `tsv`, and `txt` formats will return results in a tabular format, excluding
+ other metadata fields from the response.
:param include_ccs_metadata: When set to `true` and performing a cross-cluster
query, the response will include an extra `_clusters` object with information
about the clusters that participated in the search along with info such as
@@ -579,7 +590,7 @@ async def query(
__query["pretty"] = pretty
if not __body:
if query is not None:
- __body["query"] = query
+ __body["query"] = str(query)
if columnar is not None:
__body["columnar"] = columnar
if filter is not None:
diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py
index 2a40027c2..14daa8e31 100644
--- a/elasticsearch/_async/client/indices.py
+++ b/elasticsearch/_async/client/indices.py
@@ -1208,7 +1208,7 @@ async def delete_data_stream_options(
Removes the data stream options from a data stream.
- ``_
+ ``_
:param name: A comma-separated list of data streams of which the data stream
options will be deleted; use `*` to get all data streams
@@ -2619,7 +2619,7 @@ async def get_data_stream_options(
Get the data stream options configuration of one or more data streams.
- ``_
+ ``_
:param name: Comma-separated list of data streams to limit the request. Supports
wildcards (`*`). To target all data streams, omit this parameter or use `*`
@@ -3812,7 +3812,7 @@ async def put_data_stream_options(
Update the data stream options of the specified data streams.
- ``_
+ ``_
:param name: Comma-separated list of data streams used to limit the request.
Supports wildcards (`*`). To target all data streams use `*` or `_all`.
@@ -4179,7 +4179,7 @@ async def put_mapping(
Change a field's mapping using reindexing
Rename a field using a field alias
- Learn how to use the update mapping API with practical examples in the Update mapping API examples guide.
+ Learn how to use the update mapping API with practical examples in the Update mapping API examples guide.
``_
@@ -5150,7 +5150,7 @@ async def rollover(
.. raw:: html
Roll over to a new index.
- TIP: It is recommended to use the index lifecycle rollover action to automate rollovers.
+ TIP: We recommend using the index lifecycle rollover action to automate rollovers. However, Serverless does not support Index Lifecycle Management (ILM), so don't use this approach in the Serverless context.
The rollover API creates a new index for a data stream or index alias.
The API behavior depends on the rollover target.
Roll over a data stream
diff --git a/elasticsearch/_async/client/inference.py b/elasticsearch/_async/client/inference.py
index 58b51a72e..686d99d27 100644
--- a/elasticsearch/_async/client/inference.py
+++ b/elasticsearch/_async/client/inference.py
@@ -389,23 +389,26 @@ async def put(
However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.
The following integrations are available through the inference API. You can find the available task types next to the integration name:
+ - AI21 (
chat_completion
, completion
)
- AlibabaCloud AI Search (
completion
, rerank
, sparse_embedding
, text_embedding
)
- Amazon Bedrock (
completion
, text_embedding
)
+ - Amazon SageMaker (
chat_completion
, completion
, rerank
, sparse_embedding
, text_embedding
)
- Anthropic (
completion
)
- Azure AI Studio (
completion
, 'rerank', text_embedding
)
- Azure OpenAI (
completion
, text_embedding
)
- Cohere (
completion
, rerank
, text_embedding
)
- - DeepSeek (
completion
, chat_completion
)
+ - DeepSeek (
chat_completion
, completion
)
- Elasticsearch (
rerank
, sparse_embedding
, text_embedding
- this service is for built-in models and models uploaded through Eland)
- ELSER (
sparse_embedding
)
- Google AI Studio (
completion
, text_embedding
)
- - Google Vertex AI (
rerank
, text_embedding
)
+ - Google Vertex AI (
chat_completion
, completion
, rerank
, text_embedding
)
- Hugging Face (
chat_completion
, completion
, rerank
, text_embedding
)
+ - JinaAI (
rerank
, text_embedding
)
+ - Llama (
chat_completion
, completion
, text_embedding
)
- Mistral (
chat_completion
, completion
, text_embedding
)
- OpenAI (
chat_completion
, completion
, text_embedding
)
- - VoyageAI (
text_embedding
, rerank
)
+ - VoyageAI (
rerank
, text_embedding
)
- Watsonx inference integration (
text_embedding
)
- - JinaAI (
text_embedding
, rerank
)
@@ -461,6 +464,86 @@ async def put(
path_parts=__path_parts,
)
+ @_rewrite_parameters(
+ body_fields=("service", "service_settings"),
+ )
+ async def put_ai21(
+ self,
+ *,
+ task_type: t.Union[str, t.Literal["chat_completion", "completion"]],
+ ai21_inference_id: str,
+ service: t.Optional[t.Union[str, t.Literal["ai21"]]] = None,
+ service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ error_trace: t.Optional[bool] = None,
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ human: t.Optional[bool] = None,
+ pretty: t.Optional[bool] = None,
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
+ body: t.Optional[t.Dict[str, t.Any]] = None,
+ ) -> ObjectApiResponse[t.Any]:
+ """
+ .. raw:: html
+
+ Create a AI21 inference endpoint.
+ Create an inference endpoint to perform an inference task with the ai21
service.
+
+
+ ``_
+
+ :param task_type: The type of the inference task that the model will perform.
+ :param ai21_inference_id: The unique identifier of the inference endpoint.
+ :param service: The type of service supported for the specified task type. In
+ this case, `ai21`.
+ :param service_settings: Settings used to install the inference model. These
+ settings are specific to the `ai21` service.
+ :param timeout: Specifies the amount of time to wait for the inference endpoint
+ to be created.
+ """
+ if task_type in SKIP_IN_PATH:
+ raise ValueError("Empty value passed for parameter 'task_type'")
+ if ai21_inference_id in SKIP_IN_PATH:
+ raise ValueError("Empty value passed for parameter 'ai21_inference_id'")
+ if service is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service'")
+ if service_settings is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service_settings'")
+ __path_parts: t.Dict[str, str] = {
+ "task_type": _quote(task_type),
+ "ai21_inference_id": _quote(ai21_inference_id),
+ }
+ __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["ai21_inference_id"]}'
+ __query: t.Dict[str, t.Any] = {}
+ __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 filter_path is not None:
+ __query["filter_path"] = filter_path
+ if human is not None:
+ __query["human"] = human
+ if pretty is not None:
+ __query["pretty"] = pretty
+ if timeout is not None:
+ __query["timeout"] = timeout
+ if not __body:
+ if service is not None:
+ __body["service"] = service
+ if service_settings is not None:
+ __body["service_settings"] = service_settings
+ if not __body:
+ __body = None # type: ignore[assignment]
+ __headers = {"accept": "application/json"}
+ if __body is not None:
+ __headers["content-type"] = "application/json"
+ return await self.perform_request( # type: ignore[return-value]
+ "PUT",
+ __path,
+ params=__query,
+ headers=__headers,
+ body=__body,
+ endpoint_id="inference.put_ai21",
+ path_parts=__path_parts,
+ )
+
@_rewrite_parameters(
body_fields=(
"service",
@@ -659,6 +742,112 @@ async def put_amazonbedrock(
path_parts=__path_parts,
)
+ @_rewrite_parameters(
+ body_fields=(
+ "service",
+ "service_settings",
+ "chunking_settings",
+ "task_settings",
+ ),
+ )
+ async def put_amazonsagemaker(
+ self,
+ *,
+ task_type: t.Union[
+ str,
+ t.Literal[
+ "chat_completion",
+ "completion",
+ "rerank",
+ "sparse_embedding",
+ "text_embedding",
+ ],
+ ],
+ amazonsagemaker_inference_id: str,
+ service: t.Optional[t.Union[str, t.Literal["amazon_sagemaker"]]] = None,
+ service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ chunking_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ error_trace: t.Optional[bool] = None,
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ human: t.Optional[bool] = None,
+ pretty: t.Optional[bool] = None,
+ task_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
+ body: t.Optional[t.Dict[str, t.Any]] = None,
+ ) -> ObjectApiResponse[t.Any]:
+ """
+ .. raw:: html
+
+ Create an Amazon SageMaker inference endpoint.
+ Create an inference endpoint to perform an inference task with the amazon_sagemaker
service.
+
+
+ ``_
+
+ :param task_type: The type of the inference task that the model will perform.
+ :param amazonsagemaker_inference_id: The unique identifier of the inference endpoint.
+ :param service: The type of service supported for the specified task type. In
+ this case, `amazon_sagemaker`.
+ :param service_settings: Settings used to install the inference model. These
+ settings are specific to the `amazon_sagemaker` service and `service_settings.api`
+ you specified.
+ :param chunking_settings: The chunking configuration object.
+ :param task_settings: Settings to configure the inference task. These settings
+ are specific to the task type and `service_settings.api` you specified.
+ :param timeout: Specifies the amount of time to wait for the inference endpoint
+ to be created.
+ """
+ if task_type in SKIP_IN_PATH:
+ raise ValueError("Empty value passed for parameter 'task_type'")
+ if amazonsagemaker_inference_id in SKIP_IN_PATH:
+ raise ValueError(
+ "Empty value passed for parameter 'amazonsagemaker_inference_id'"
+ )
+ if service is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service'")
+ if service_settings is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service_settings'")
+ __path_parts: t.Dict[str, str] = {
+ "task_type": _quote(task_type),
+ "amazonsagemaker_inference_id": _quote(amazonsagemaker_inference_id),
+ }
+ __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["amazonsagemaker_inference_id"]}'
+ __query: t.Dict[str, t.Any] = {}
+ __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 filter_path is not None:
+ __query["filter_path"] = filter_path
+ if human is not None:
+ __query["human"] = human
+ if pretty is not None:
+ __query["pretty"] = pretty
+ if timeout is not None:
+ __query["timeout"] = timeout
+ if not __body:
+ if service is not None:
+ __body["service"] = service
+ if service_settings is not None:
+ __body["service_settings"] = service_settings
+ if chunking_settings is not None:
+ __body["chunking_settings"] = chunking_settings
+ if task_settings is not None:
+ __body["task_settings"] = task_settings
+ if not __body:
+ __body = None # type: ignore[assignment]
+ __headers = {"accept": "application/json"}
+ if __body is not None:
+ __headers["content-type"] = "application/json"
+ return await self.perform_request( # type: ignore[return-value]
+ "PUT",
+ __path,
+ params=__query,
+ headers=__headers,
+ body=__body,
+ endpoint_id="inference.put_amazonsagemaker",
+ path_parts=__path_parts,
+ )
+
@_rewrite_parameters(
body_fields=(
"service",
@@ -1887,6 +2076,92 @@ async def put_jinaai(
path_parts=__path_parts,
)
+ @_rewrite_parameters(
+ body_fields=("service", "service_settings", "chunking_settings"),
+ )
+ async def put_llama(
+ self,
+ *,
+ task_type: t.Union[
+ str, t.Literal["chat_completion", "completion", "text_embedding"]
+ ],
+ llama_inference_id: str,
+ service: t.Optional[t.Union[str, t.Literal["llama"]]] = None,
+ service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ chunking_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ error_trace: t.Optional[bool] = None,
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ human: t.Optional[bool] = None,
+ pretty: t.Optional[bool] = None,
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
+ body: t.Optional[t.Dict[str, t.Any]] = None,
+ ) -> ObjectApiResponse[t.Any]:
+ """
+ .. raw:: html
+
+ Create a Llama inference endpoint.
+ Create an inference endpoint to perform an inference task with the llama
service.
+
+
+ ``_
+
+ :param task_type: The type of the inference task that the model will perform.
+ :param llama_inference_id: The unique identifier of the inference endpoint.
+ :param service: The type of service supported for the specified task type. In
+ this case, `llama`.
+ :param service_settings: Settings used to install the inference model. These
+ settings are specific to the `llama` service.
+ :param chunking_settings: The chunking configuration object.
+ :param timeout: Specifies the amount of time to wait for the inference endpoint
+ to be created.
+ """
+ if task_type in SKIP_IN_PATH:
+ raise ValueError("Empty value passed for parameter 'task_type'")
+ if llama_inference_id in SKIP_IN_PATH:
+ raise ValueError("Empty value passed for parameter 'llama_inference_id'")
+ if service is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service'")
+ if service_settings is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service_settings'")
+ __path_parts: t.Dict[str, str] = {
+ "task_type": _quote(task_type),
+ "llama_inference_id": _quote(llama_inference_id),
+ }
+ __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["llama_inference_id"]}'
+ __query: t.Dict[str, t.Any] = {}
+ __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 filter_path is not None:
+ __query["filter_path"] = filter_path
+ if human is not None:
+ __query["human"] = human
+ if pretty is not None:
+ __query["pretty"] = pretty
+ if timeout is not None:
+ __query["timeout"] = timeout
+ if not __body:
+ if service is not None:
+ __body["service"] = service
+ if service_settings is not None:
+ __body["service_settings"] = service_settings
+ if chunking_settings is not None:
+ __body["chunking_settings"] = chunking_settings
+ if not __body:
+ __body = None # type: ignore[assignment]
+ __headers = {"accept": "application/json"}
+ if __body is not None:
+ __headers["content-type"] = "application/json"
+ return await self.perform_request( # type: ignore[return-value]
+ "PUT",
+ __path,
+ params=__query,
+ headers=__headers,
+ body=__body,
+ endpoint_id="inference.put_llama",
+ path_parts=__path_parts,
+ )
+
@_rewrite_parameters(
body_fields=("service", "service_settings", "chunking_settings"),
)
diff --git a/elasticsearch/_async/client/simulate.py b/elasticsearch/_async/client/simulate.py
index bb636ddb6..ae59515ed 100644
--- a/elasticsearch/_async/client/simulate.py
+++ b/elasticsearch/_async/client/simulate.py
@@ -56,6 +56,7 @@ async def ingest(
t.Mapping[str, t.Mapping[str, t.Any]]
] = None,
mapping_addition: t.Optional[t.Mapping[str, t.Any]] = None,
+ merge_type: t.Optional[t.Union[str, t.Literal["index", "template"]]] = None,
pipeline: t.Optional[str] = None,
pipeline_substitutions: t.Optional[
t.Mapping[str, t.Mapping[str, t.Any]]
@@ -93,6 +94,11 @@ async def ingest(
:param index_template_substitutions: A map of index template names to substitute
index template definition objects.
:param mapping_addition:
+ :param merge_type: The mapping merge type if mapping overrides are being provided
+ in mapping_addition. The allowed values are one of index or template. The
+ index option merges mappings the way they would be merged into an existing
+ index. The template option merges mappings the way they would be merged into
+ a template.
:param pipeline: The pipeline to use as the default pipeline. This value can
be used to override the default pipeline of the index.
:param pipeline_substitutions: Pipelines to test. If you don’t specify the `pipeline`
@@ -116,6 +122,8 @@ async def ingest(
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
+ if merge_type is not None:
+ __query["merge_type"] = merge_type
if pipeline is not None:
__query["pipeline"] = pipeline
if pretty is not None:
diff --git a/elasticsearch/_async/client/sql.py b/elasticsearch/_async/client/sql.py
index 3eb37a6cc..de423ea66 100644
--- a/elasticsearch/_async/client/sql.py
+++ b/elasticsearch/_async/client/sql.py
@@ -283,7 +283,7 @@ async def query(
keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
keep_on_completion: t.Optional[bool] = None,
page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
- params: t.Optional[t.Mapping[str, t.Any]] = None,
+ params: t.Optional[t.Sequence[t.Any]] = None,
pretty: t.Optional[bool] = None,
query: t.Optional[str] = None,
request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
diff --git a/elasticsearch/_async/client/transform.py b/elasticsearch/_async/client/transform.py
index 191c959d3..249fa35cb 100644
--- a/elasticsearch/_async/client/transform.py
+++ b/elasticsearch/_async/client/transform.py
@@ -602,6 +602,66 @@ async def schedule_now_transform(
path_parts=__path_parts,
)
+ @_rewrite_parameters()
+ async def set_upgrade_mode(
+ self,
+ *,
+ enabled: 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,
+ pretty: t.Optional[bool] = None,
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
+ ) -> ObjectApiResponse[t.Any]:
+ """
+ .. raw:: html
+
+ Set upgrade_mode for transform indices.
+ Sets a cluster wide upgrade_mode setting that prepares transform
+ indices for an upgrade.
+ When upgrading your cluster, in some circumstances you must restart your
+ nodes and reindex your transform indices. In those circumstances,
+ there must be no transforms running. You can close the transforms,
+ do the upgrade, then open all the transforms again. Alternatively,
+ you can use this API to temporarily halt tasks associated with the transforms
+ and prevent new transforms from opening. You can also use this API
+ during upgrades that do not require you to reindex your transform
+ indices, though stopping transforms is not a requirement in that case.
+ You can see the current value for the upgrade_mode setting by using the get
+ transform info API.
+
+
+ ``_
+
+ :param enabled: When `true`, it enables `upgrade_mode` which temporarily halts
+ all transform tasks and prohibits new transform tasks from starting.
+ :param timeout: The time to wait for the request to be completed.
+ """
+ __path_parts: t.Dict[str, str] = {}
+ __path = "/_transform/set_upgrade_mode"
+ __query: t.Dict[str, t.Any] = {}
+ if enabled is not None:
+ __query["enabled"] = enabled
+ if error_trace is not None:
+ __query["error_trace"] = error_trace
+ if filter_path is not None:
+ __query["filter_path"] = filter_path
+ if human is not None:
+ __query["human"] = human
+ 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]
+ "POST",
+ __path,
+ params=__query,
+ headers=__headers,
+ endpoint_id="transform.set_upgrade_mode",
+ path_parts=__path_parts,
+ )
+
@_rewrite_parameters(
parameter_aliases={"from": "from_"},
)
diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py
index 5f7a4313d..4f97411c1 100644
--- a/elasticsearch/_sync/client/__init__.py
+++ b/elasticsearch/_sync/client/__init__.py
@@ -606,6 +606,7 @@ def bulk(
JavaScript: Check out client.helpers.*
.NET: Check out BulkAllObservable
PHP: Check out bulk indexing.
+ Ruby: Check out Elasticsearch::Helpers::BulkHelper
Submitting bulk requests with cURL
If you're providing text file input to curl
, you must use the --data-binary
flag instead of plain -d
.
@@ -1324,7 +1325,7 @@ def delete(
)
@_rewrite_parameters(
- body_fields=("max_docs", "query", "slice"),
+ body_fields=("max_docs", "query", "slice", "sort"),
parameter_aliases={"from": "from_"},
)
def delete_by_query(
@@ -1368,7 +1369,12 @@ def delete_by_query(
] = None,
slice: t.Optional[t.Mapping[str, t.Any]] = None,
slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
- sort: t.Optional[t.Sequence[str]] = None,
+ sort: t.Optional[
+ t.Union[
+ t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
+ t.Union[str, t.Mapping[str, t.Any]],
+ ]
+ ] = None,
stats: t.Optional[t.Sequence[str]] = None,
terminate_after: t.Optional[int] = None,
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -1500,7 +1506,7 @@ def delete_by_query(
:param slice: Slice the request manually using the provided slice ID and total
number of slices.
:param slices: The number of slices this task should be divided into.
- :param sort: A comma-separated list of `:` pairs.
+ :param sort: A sort object that specifies the order of deleted documents.
:param stats: The specific `tag` of the request for logging and statistical purposes.
:param terminate_after: The maximum number of documents to collect for each shard.
If a query reaches this limit, Elasticsearch terminates the query early.
@@ -1590,8 +1596,6 @@ def delete_by_query(
__query["search_type"] = search_type
if slices is not None:
__query["slices"] = slices
- if sort is not None:
- __query["sort"] = sort
if stats is not None:
__query["stats"] = stats
if terminate_after is not None:
@@ -1611,6 +1615,8 @@ def delete_by_query(
__body["query"] = query
if slice is not None:
__body["slice"] = slice
+ if sort is not None:
+ __body["sort"] = sort
__headers = {"accept": "application/json", "content-type": "application/json"}
return self.perform_request( # type: ignore[return-value]
"POST",
@@ -3873,6 +3879,13 @@ def reindex(
In this case, the response includes a count of the version conflicts that were encountered.
Note that the handling of other error types is unaffected by the conflicts
property.
Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs
until it has successfully indexed max_docs
documents into the target or it has gone through every document in the source query.
+ It's recommended to reindex on indices with a green status. Reindexing can fail when a node shuts down or crashes.
+
+ - When requested with
wait_for_completion=true
(default), the request fails if the node shuts down.
+ - When requested with
wait_for_completion=false
, a task id is returned, for use with the task management APIs. The task may disappear or fail if the node shuts down.
+ When retrying a failed reindex operation, it might be necessary to set conflicts=proceed
or to first delete the partial destination index.
+ Additionally, dry runs, checking disk space, and fetching index recovery information can help address the root cause.
+
Refer to the linked documentation for examples of how to reindex documents.
@@ -5657,7 +5670,7 @@ def termvectors(
doc: t.Optional[t.Mapping[str, t.Any]] = None,
error_trace: t.Optional[bool] = None,
field_statistics: t.Optional[bool] = None,
- fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ fields: t.Optional[t.Sequence[str]] = None,
filter: t.Optional[t.Mapping[str, t.Any]] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
diff --git a/elasticsearch/_sync/client/cat.py b/elasticsearch/_sync/client/cat.py
index b1ab46d99..fad330ae1 100644
--- a/elasticsearch/_sync/client/cat.py
+++ b/elasticsearch/_sync/client/cat.py
@@ -47,7 +47,34 @@ def aliases(
] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ h: t.Optional[
+ t.Union[
+ t.Sequence[
+ t.Union[
+ str,
+ t.Literal[
+ "alias",
+ "filter",
+ "index",
+ "is_write_index",
+ "routing.index",
+ "routing.search",
+ ],
+ ]
+ ],
+ t.Union[
+ str,
+ t.Literal[
+ "alias",
+ "filter",
+ "index",
+ "is_write_index",
+ "routing.index",
+ "routing.search",
+ ],
+ ],
+ ]
+ ] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -74,7 +101,8 @@ def aliases(
values, such as `open,hidden`.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
- :param h: List of columns to appear in the response. Supports simple wildcards.
+ :param h: A comma-separated list of columns names to display. It supports simple
+ wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param master_timeout: The period to wait for a connection to the master node.
@@ -137,7 +165,48 @@ def allocation(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ h: t.Optional[
+ t.Union[
+ t.Sequence[
+ t.Union[
+ str,
+ t.Literal[
+ "disk.avail",
+ "disk.indices",
+ "disk.indices.forecast",
+ "disk.percent",
+ "disk.total",
+ "disk.used",
+ "host",
+ "ip",
+ "node",
+ "node.role",
+ "shards",
+ "shards.undesired",
+ "write_load.forecast",
+ ],
+ ]
+ ],
+ t.Union[
+ str,
+ t.Literal[
+ "disk.avail",
+ "disk.indices",
+ "disk.indices.forecast",
+ "disk.percent",
+ "disk.total",
+ "disk.used",
+ "host",
+ "ip",
+ "node",
+ "node.role",
+ "shards",
+ "shards.undesired",
+ "write_load.forecast",
+ ],
+ ],
+ ]
+ ] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
local: t.Optional[bool] = None,
@@ -161,7 +230,8 @@ def allocation(
:param bytes: The unit used to display byte values.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
- :param h: List of columns to appear in the response. Supports simple wildcards.
+ :param h: A comma-separated list of columns names to display. It supports simple
+ wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param local: If `true`, the request computes the list of selected nodes from
@@ -224,7 +294,36 @@ def component_templates(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ h: t.Optional[
+ t.Union[
+ t.Sequence[
+ t.Union[
+ str,
+ t.Literal[
+ "alias_count",
+ "included_in",
+ "mapping_count",
+ "metadata_count",
+ "name",
+ "settings_count",
+ "version",
+ ],
+ ]
+ ],
+ t.Union[
+ str,
+ t.Literal[
+ "alias_count",
+ "included_in",
+ "mapping_count",
+ "metadata_count",
+ "name",
+ "settings_count",
+ "version",
+ ],
+ ],
+ ]
+ ] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
local: t.Optional[bool] = None,
@@ -249,7 +348,8 @@ def component_templates(
If it is omitted, all component templates are returned.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
- :param h: List of columns to appear in the response. Supports simple wildcards.
+ :param h: A comma-separated list of columns names to display. It supports simple
+ wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param local: If `true`, the request computes the list of selected nodes from
@@ -310,7 +410,12 @@ def count(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ h: t.Optional[
+ t.Union[
+ t.Sequence[t.Union[str, t.Literal["count", "epoch", "timestamp"]]],
+ t.Union[str, t.Literal["count", "epoch", "timestamp"]],
+ ]
+ ] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
@@ -334,7 +439,8 @@ def count(
and indices, omit this parameter or use `*` or `_all`.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
- :param h: List of columns to appear in the response. Supports simple wildcards.
+ :param h: A comma-separated list of columns names to display. It supports simple
+ wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param s: List of columns that determine how the table should be sorted. Sorting
@@ -389,7 +495,14 @@ def fielddata(
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
format: t.Optional[str] = None,
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ h: t.Optional[
+ t.Union[
+ t.Sequence[
+ t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]]
+ ],
+ t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]],
+ ]
+ ] = None,
help: t.Optional[bool] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
@@ -412,7 +525,8 @@ def fielddata(
:param bytes: The unit used to display byte values.
:param format: Specifies the format to return the columnar data in, can be set
to `text`, `json`, `cbor`, `yaml`, or `smile`.
- :param h: List of columns to appear in the response. Supports simple wildcards.
+ :param h: A comma-separated list of columns names to display. It supports simple
+ wildcards.
:param help: When set to `true` will output available columns. This option can't
be combined with any other query string option.
:param s: List of columns that determine how the table should be sorted. Sorting
diff --git a/elasticsearch/_sync/client/cluster.py b/elasticsearch/_sync/client/cluster.py
index a56892d54..46cb6059f 100644
--- a/elasticsearch/_sync/client/cluster.py
+++ b/elasticsearch/_sync/client/cluster.py
@@ -374,8 +374,13 @@ def get_settings(
``_
:param flat_settings: If `true`, returns settings in flat format.
- :param include_defaults: If `true`, returns default cluster settings from the
- local node.
+ :param include_defaults: If `true`, also returns default values for all other
+ cluster settings, reflecting the values in the `elasticsearch.yml` file of
+ one of the nodes in the cluster. If the nodes in your cluster do not all
+ have the same values in their `elasticsearch.yml` config files then the values
+ returned by this API may vary from invocation to invocation and may not reflect
+ the values that Elasticsearch uses in all situations. Use the `GET _nodes/settings`
+ API to fetch the settings for each individual node in your cluster.
: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.
diff --git a/elasticsearch/_sync/client/esql.py b/elasticsearch/_sync/client/esql.py
index 0744a81bd..b91301af2 100644
--- a/elasticsearch/_sync/client/esql.py
+++ b/elasticsearch/_sync/client/esql.py
@@ -50,7 +50,7 @@ class EsqlClient(NamespacedClient):
def async_query(
self,
*,
- query: t.Optional[str] = None,
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
allow_partial_results: t.Optional[bool] = None,
columnar: t.Optional[bool] = None,
delimiter: t.Optional[str] = None,
@@ -111,7 +111,12 @@ def async_query(
which has the name of all the columns.
:param filter: Specify a Query DSL query in the filter parameter to filter the
set of documents that an ES|QL query runs on.
- :param format: A short version of the Accept header, for example `json` or `yaml`.
+ :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
+ `tsv`, and `txt` formats will return results in a tabular format, excluding
+ other metadata fields from the response. For async requests, nothing will
+ be returned if the async query doesn't finish within the timeout. The query
+ ID and running status are available in the `X-Elasticsearch-Async-Id` and
+ `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively.
:param include_ccs_metadata: When set to `true` and performing a cross-cluster
query, the response will include an extra `_clusters` object with information
about the clusters that participated in the search along with info such as
@@ -165,7 +170,7 @@ def async_query(
__query["pretty"] = pretty
if not __body:
if query is not None:
- __body["query"] = query
+ __body["query"] = str(query)
if columnar is not None:
__body["columnar"] = columnar
if filter is not None:
@@ -405,6 +410,8 @@ def get_query(
Returns an object extended information about a running ES|QL query.
+ ``_
+
:param id: The query ID
"""
if id in SKIP_IN_PATH:
@@ -446,6 +453,8 @@ def list_queries(
Get running ES|QL queries information.
Returns an object containing IDs and other information about the running ES|QL queries.
+
+ ``_
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_query/queries"
@@ -484,7 +493,7 @@ def list_queries(
def query(
self,
*,
- query: t.Optional[str] = None,
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
allow_partial_results: t.Optional[bool] = None,
columnar: t.Optional[bool] = None,
delimiter: t.Optional[str] = None,
@@ -539,7 +548,9 @@ def query(
`all_columns` which has the name of all columns.
:param filter: Specify a Query DSL query in the filter parameter to filter the
set of documents that an ES|QL query runs on.
- :param format: A short version of the Accept header, e.g. json, yaml.
+ :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
+ `tsv`, and `txt` formats will return results in a tabular format, excluding
+ other metadata fields from the response.
:param include_ccs_metadata: When set to `true` and performing a cross-cluster
query, the response will include an extra `_clusters` object with information
about the clusters that participated in the search along with info such as
@@ -579,7 +590,7 @@ def query(
__query["pretty"] = pretty
if not __body:
if query is not None:
- __body["query"] = query
+ __body["query"] = str(query)
if columnar is not None:
__body["columnar"] = columnar
if filter is not None:
diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py
index 8697d971b..ad6b8bc6e 100644
--- a/elasticsearch/_sync/client/indices.py
+++ b/elasticsearch/_sync/client/indices.py
@@ -1208,7 +1208,7 @@ def delete_data_stream_options(
Removes the data stream options from a data stream.
- ``_
+ ``_
:param name: A comma-separated list of data streams of which the data stream
options will be deleted; use `*` to get all data streams
@@ -2619,7 +2619,7 @@ def get_data_stream_options(
Get the data stream options configuration of one or more data streams.
- ``_
+ ``_
:param name: Comma-separated list of data streams to limit the request. Supports
wildcards (`*`). To target all data streams, omit this parameter or use `*`
@@ -3812,7 +3812,7 @@ def put_data_stream_options(
Update the data stream options of the specified data streams.
- ``_
+ ``_
:param name: Comma-separated list of data streams used to limit the request.
Supports wildcards (`*`). To target all data streams use `*` or `_all`.
@@ -4179,7 +4179,7 @@ def put_mapping(
Change a field's mapping using reindexing
Rename a field using a field alias
- Learn how to use the update mapping API with practical examples in the Update mapping API examples guide.
+ Learn how to use the update mapping API with practical examples in the Update mapping API examples guide.
``_
@@ -5150,7 +5150,7 @@ def rollover(
.. raw:: html
Roll over to a new index.
- TIP: It is recommended to use the index lifecycle rollover action to automate rollovers.
+ TIP: We recommend using the index lifecycle rollover action to automate rollovers. However, Serverless does not support Index Lifecycle Management (ILM), so don't use this approach in the Serverless context.
The rollover API creates a new index for a data stream or index alias.
The API behavior depends on the rollover target.
Roll over a data stream
diff --git a/elasticsearch/_sync/client/inference.py b/elasticsearch/_sync/client/inference.py
index b7bab7f1c..47fc86fd5 100644
--- a/elasticsearch/_sync/client/inference.py
+++ b/elasticsearch/_sync/client/inference.py
@@ -389,23 +389,26 @@ def put(
However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.
The following integrations are available through the inference API. You can find the available task types next to the integration name:
+ - AI21 (
chat_completion
, completion
)
- AlibabaCloud AI Search (
completion
, rerank
, sparse_embedding
, text_embedding
)
- Amazon Bedrock (
completion
, text_embedding
)
+ - Amazon SageMaker (
chat_completion
, completion
, rerank
, sparse_embedding
, text_embedding
)
- Anthropic (
completion
)
- Azure AI Studio (
completion
, 'rerank', text_embedding
)
- Azure OpenAI (
completion
, text_embedding
)
- Cohere (
completion
, rerank
, text_embedding
)
- - DeepSeek (
completion
, chat_completion
)
+ - DeepSeek (
chat_completion
, completion
)
- Elasticsearch (
rerank
, sparse_embedding
, text_embedding
- this service is for built-in models and models uploaded through Eland)
- ELSER (
sparse_embedding
)
- Google AI Studio (
completion
, text_embedding
)
- - Google Vertex AI (
rerank
, text_embedding
)
+ - Google Vertex AI (
chat_completion
, completion
, rerank
, text_embedding
)
- Hugging Face (
chat_completion
, completion
, rerank
, text_embedding
)
+ - JinaAI (
rerank
, text_embedding
)
+ - Llama (
chat_completion
, completion
, text_embedding
)
- Mistral (
chat_completion
, completion
, text_embedding
)
- OpenAI (
chat_completion
, completion
, text_embedding
)
- - VoyageAI (
text_embedding
, rerank
)
+ - VoyageAI (
rerank
, text_embedding
)
- Watsonx inference integration (
text_embedding
)
- - JinaAI (
text_embedding
, rerank
)
@@ -461,6 +464,86 @@ def put(
path_parts=__path_parts,
)
+ @_rewrite_parameters(
+ body_fields=("service", "service_settings"),
+ )
+ def put_ai21(
+ self,
+ *,
+ task_type: t.Union[str, t.Literal["chat_completion", "completion"]],
+ ai21_inference_id: str,
+ service: t.Optional[t.Union[str, t.Literal["ai21"]]] = None,
+ service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ error_trace: t.Optional[bool] = None,
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ human: t.Optional[bool] = None,
+ pretty: t.Optional[bool] = None,
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
+ body: t.Optional[t.Dict[str, t.Any]] = None,
+ ) -> ObjectApiResponse[t.Any]:
+ """
+ .. raw:: html
+
+ Create a AI21 inference endpoint.
+ Create an inference endpoint to perform an inference task with the ai21
service.
+
+
+ ``_
+
+ :param task_type: The type of the inference task that the model will perform.
+ :param ai21_inference_id: The unique identifier of the inference endpoint.
+ :param service: The type of service supported for the specified task type. In
+ this case, `ai21`.
+ :param service_settings: Settings used to install the inference model. These
+ settings are specific to the `ai21` service.
+ :param timeout: Specifies the amount of time to wait for the inference endpoint
+ to be created.
+ """
+ if task_type in SKIP_IN_PATH:
+ raise ValueError("Empty value passed for parameter 'task_type'")
+ if ai21_inference_id in SKIP_IN_PATH:
+ raise ValueError("Empty value passed for parameter 'ai21_inference_id'")
+ if service is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service'")
+ if service_settings is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service_settings'")
+ __path_parts: t.Dict[str, str] = {
+ "task_type": _quote(task_type),
+ "ai21_inference_id": _quote(ai21_inference_id),
+ }
+ __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["ai21_inference_id"]}'
+ __query: t.Dict[str, t.Any] = {}
+ __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 filter_path is not None:
+ __query["filter_path"] = filter_path
+ if human is not None:
+ __query["human"] = human
+ if pretty is not None:
+ __query["pretty"] = pretty
+ if timeout is not None:
+ __query["timeout"] = timeout
+ if not __body:
+ if service is not None:
+ __body["service"] = service
+ if service_settings is not None:
+ __body["service_settings"] = service_settings
+ if not __body:
+ __body = None # type: ignore[assignment]
+ __headers = {"accept": "application/json"}
+ if __body is not None:
+ __headers["content-type"] = "application/json"
+ return self.perform_request( # type: ignore[return-value]
+ "PUT",
+ __path,
+ params=__query,
+ headers=__headers,
+ body=__body,
+ endpoint_id="inference.put_ai21",
+ path_parts=__path_parts,
+ )
+
@_rewrite_parameters(
body_fields=(
"service",
@@ -659,6 +742,112 @@ def put_amazonbedrock(
path_parts=__path_parts,
)
+ @_rewrite_parameters(
+ body_fields=(
+ "service",
+ "service_settings",
+ "chunking_settings",
+ "task_settings",
+ ),
+ )
+ def put_amazonsagemaker(
+ self,
+ *,
+ task_type: t.Union[
+ str,
+ t.Literal[
+ "chat_completion",
+ "completion",
+ "rerank",
+ "sparse_embedding",
+ "text_embedding",
+ ],
+ ],
+ amazonsagemaker_inference_id: str,
+ service: t.Optional[t.Union[str, t.Literal["amazon_sagemaker"]]] = None,
+ service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ chunking_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ error_trace: t.Optional[bool] = None,
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ human: t.Optional[bool] = None,
+ pretty: t.Optional[bool] = None,
+ task_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
+ body: t.Optional[t.Dict[str, t.Any]] = None,
+ ) -> ObjectApiResponse[t.Any]:
+ """
+ .. raw:: html
+
+ Create an Amazon SageMaker inference endpoint.
+ Create an inference endpoint to perform an inference task with the amazon_sagemaker
service.
+
+
+ ``_
+
+ :param task_type: The type of the inference task that the model will perform.
+ :param amazonsagemaker_inference_id: The unique identifier of the inference endpoint.
+ :param service: The type of service supported for the specified task type. In
+ this case, `amazon_sagemaker`.
+ :param service_settings: Settings used to install the inference model. These
+ settings are specific to the `amazon_sagemaker` service and `service_settings.api`
+ you specified.
+ :param chunking_settings: The chunking configuration object.
+ :param task_settings: Settings to configure the inference task. These settings
+ are specific to the task type and `service_settings.api` you specified.
+ :param timeout: Specifies the amount of time to wait for the inference endpoint
+ to be created.
+ """
+ if task_type in SKIP_IN_PATH:
+ raise ValueError("Empty value passed for parameter 'task_type'")
+ if amazonsagemaker_inference_id in SKIP_IN_PATH:
+ raise ValueError(
+ "Empty value passed for parameter 'amazonsagemaker_inference_id'"
+ )
+ if service is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service'")
+ if service_settings is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service_settings'")
+ __path_parts: t.Dict[str, str] = {
+ "task_type": _quote(task_type),
+ "amazonsagemaker_inference_id": _quote(amazonsagemaker_inference_id),
+ }
+ __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["amazonsagemaker_inference_id"]}'
+ __query: t.Dict[str, t.Any] = {}
+ __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 filter_path is not None:
+ __query["filter_path"] = filter_path
+ if human is not None:
+ __query["human"] = human
+ if pretty is not None:
+ __query["pretty"] = pretty
+ if timeout is not None:
+ __query["timeout"] = timeout
+ if not __body:
+ if service is not None:
+ __body["service"] = service
+ if service_settings is not None:
+ __body["service_settings"] = service_settings
+ if chunking_settings is not None:
+ __body["chunking_settings"] = chunking_settings
+ if task_settings is not None:
+ __body["task_settings"] = task_settings
+ if not __body:
+ __body = None # type: ignore[assignment]
+ __headers = {"accept": "application/json"}
+ if __body is not None:
+ __headers["content-type"] = "application/json"
+ return self.perform_request( # type: ignore[return-value]
+ "PUT",
+ __path,
+ params=__query,
+ headers=__headers,
+ body=__body,
+ endpoint_id="inference.put_amazonsagemaker",
+ path_parts=__path_parts,
+ )
+
@_rewrite_parameters(
body_fields=(
"service",
@@ -1887,6 +2076,92 @@ def put_jinaai(
path_parts=__path_parts,
)
+ @_rewrite_parameters(
+ body_fields=("service", "service_settings", "chunking_settings"),
+ )
+ def put_llama(
+ self,
+ *,
+ task_type: t.Union[
+ str, t.Literal["chat_completion", "completion", "text_embedding"]
+ ],
+ llama_inference_id: str,
+ service: t.Optional[t.Union[str, t.Literal["llama"]]] = None,
+ service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ chunking_settings: t.Optional[t.Mapping[str, t.Any]] = None,
+ error_trace: t.Optional[bool] = None,
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
+ human: t.Optional[bool] = None,
+ pretty: t.Optional[bool] = None,
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
+ body: t.Optional[t.Dict[str, t.Any]] = None,
+ ) -> ObjectApiResponse[t.Any]:
+ """
+ .. raw:: html
+
+ Create a Llama inference endpoint.
+ Create an inference endpoint to perform an inference task with the llama
service.
+
+
+ ``_
+
+ :param task_type: The type of the inference task that the model will perform.
+ :param llama_inference_id: The unique identifier of the inference endpoint.
+ :param service: The type of service supported for the specified task type. In
+ this case, `llama`.
+ :param service_settings: Settings used to install the inference model. These
+ settings are specific to the `llama` service.
+ :param chunking_settings: The chunking configuration object.
+ :param timeout: Specifies the amount of time to wait for the inference endpoint
+ to be created.
+ """
+ if task_type in SKIP_IN_PATH:
+ raise ValueError("Empty value passed for parameter 'task_type'")
+ if llama_inference_id in SKIP_IN_PATH:
+ raise ValueError("Empty value passed for parameter 'llama_inference_id'")
+ if service is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service'")
+ if service_settings is None and body is None:
+ raise ValueError("Empty value passed for parameter 'service_settings'")
+ __path_parts: t.Dict[str, str] = {
+ "task_type": _quote(task_type),
+ "llama_inference_id": _quote(llama_inference_id),
+ }
+ __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["llama_inference_id"]}'
+ __query: t.Dict[str, t.Any] = {}
+ __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 filter_path is not None:
+ __query["filter_path"] = filter_path
+ if human is not None:
+ __query["human"] = human
+ if pretty is not None:
+ __query["pretty"] = pretty
+ if timeout is not None:
+ __query["timeout"] = timeout
+ if not __body:
+ if service is not None:
+ __body["service"] = service
+ if service_settings is not None:
+ __body["service_settings"] = service_settings
+ if chunking_settings is not None:
+ __body["chunking_settings"] = chunking_settings
+ if not __body:
+ __body = None # type: ignore[assignment]
+ __headers = {"accept": "application/json"}
+ if __body is not None:
+ __headers["content-type"] = "application/json"
+ return self.perform_request( # type: ignore[return-value]
+ "PUT",
+ __path,
+ params=__query,
+ headers=__headers,
+ body=__body,
+ endpoint_id="inference.put_llama",
+ path_parts=__path_parts,
+ )
+
@_rewrite_parameters(
body_fields=("service", "service_settings", "chunking_settings"),
)
diff --git a/elasticsearch/_sync/client/simulate.py b/elasticsearch/_sync/client/simulate.py
index 5f22ae433..d49a9a781 100644
--- a/elasticsearch/_sync/client/simulate.py
+++ b/elasticsearch/_sync/client/simulate.py
@@ -56,6 +56,7 @@ def ingest(
t.Mapping[str, t.Mapping[str, t.Any]]
] = None,
mapping_addition: t.Optional[t.Mapping[str, t.Any]] = None,
+ merge_type: t.Optional[t.Union[str, t.Literal["index", "template"]]] = None,
pipeline: t.Optional[str] = None,
pipeline_substitutions: t.Optional[
t.Mapping[str, t.Mapping[str, t.Any]]
@@ -93,6 +94,11 @@ def ingest(
:param index_template_substitutions: A map of index template names to substitute
index template definition objects.
:param mapping_addition:
+ :param merge_type: The mapping merge type if mapping overrides are being provided
+ in mapping_addition. The allowed values are one of index or template. The
+ index option merges mappings the way they would be merged into an existing
+ index. The template option merges mappings the way they would be merged into
+ a template.
:param pipeline: The pipeline to use as the default pipeline. This value can
be used to override the default pipeline of the index.
:param pipeline_substitutions: Pipelines to test. If you don’t specify the `pipeline`
@@ -116,6 +122,8 @@ def ingest(
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
+ if merge_type is not None:
+ __query["merge_type"] = merge_type
if pipeline is not None:
__query["pipeline"] = pipeline
if pretty is not None:
diff --git a/elasticsearch/_sync/client/sql.py b/elasticsearch/_sync/client/sql.py
index 90cb01681..b2750ede1 100644
--- a/elasticsearch/_sync/client/sql.py
+++ b/elasticsearch/_sync/client/sql.py
@@ -283,7 +283,7 @@ def query(
keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
keep_on_completion: t.Optional[bool] = None,
page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
- params: t.Optional[t.Mapping[str, t.Any]] = None,
+ params: t.Optional[t.Sequence[t.Any]] = None,
pretty: t.Optional[bool] = None,
query: t.Optional[str] = None,
request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
diff --git a/elasticsearch/_sync/client/transform.py b/elasticsearch/_sync/client/transform.py
index ea9941f74..c8c8b0d8b 100644
--- a/elasticsearch/_sync/client/transform.py
+++ b/elasticsearch/_sync/client/transform.py
@@ -602,6 +602,66 @@ def schedule_now_transform(
path_parts=__path_parts,
)
+ @_rewrite_parameters()
+ def set_upgrade_mode(
+ self,
+ *,
+ enabled: 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,
+ pretty: t.Optional[bool] = None,
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
+ ) -> ObjectApiResponse[t.Any]:
+ """
+ .. raw:: html
+
+ Set upgrade_mode for transform indices.
+ Sets a cluster wide upgrade_mode setting that prepares transform
+ indices for an upgrade.
+ When upgrading your cluster, in some circumstances you must restart your
+ nodes and reindex your transform indices. In those circumstances,
+ there must be no transforms running. You can close the transforms,
+ do the upgrade, then open all the transforms again. Alternatively,
+ you can use this API to temporarily halt tasks associated with the transforms
+ and prevent new transforms from opening. You can also use this API
+ during upgrades that do not require you to reindex your transform
+ indices, though stopping transforms is not a requirement in that case.
+ You can see the current value for the upgrade_mode setting by using the get
+ transform info API.
+
+
+ ``_
+
+ :param enabled: When `true`, it enables `upgrade_mode` which temporarily halts
+ all transform tasks and prohibits new transform tasks from starting.
+ :param timeout: The time to wait for the request to be completed.
+ """
+ __path_parts: t.Dict[str, str] = {}
+ __path = "/_transform/set_upgrade_mode"
+ __query: t.Dict[str, t.Any] = {}
+ if enabled is not None:
+ __query["enabled"] = enabled
+ if error_trace is not None:
+ __query["error_trace"] = error_trace
+ if filter_path is not None:
+ __query["filter_path"] = filter_path
+ if human is not None:
+ __query["human"] = human
+ if pretty is not None:
+ __query["pretty"] = pretty
+ if timeout is not None:
+ __query["timeout"] = timeout
+ __headers = {"accept": "application/json"}
+ return self.perform_request( # type: ignore[return-value]
+ "POST",
+ __path,
+ params=__query,
+ headers=__headers,
+ endpoint_id="transform.set_upgrade_mode",
+ path_parts=__path_parts,
+ )
+
@_rewrite_parameters(
parameter_aliases={"from": "from_"},
)
diff --git a/elasticsearch/dsl/types.py b/elasticsearch/dsl/types.py
index 383a69d83..0c8c5f3c2 100644
--- a/elasticsearch/dsl/types.py
+++ b/elasticsearch/dsl/types.py
@@ -150,24 +150,23 @@ class ChunkingSettings(AttrDict[Any]):
or`separator_group` Learn more about different chunking
strategies in the linked documentation. Defaults to `sentence` if
omitted.
- :arg separator_group: (required) This parameter is only applicable
- when using the `recursive` chunking strategy. Sets a predefined
- list of separators in the saved chunking settings based on the
- selected text type. Values can be `markdown` or `plaintext`.
- Using this parameter is an alternative to manually specifying a
- custom `separators` list.
- :arg separators: (required) A list of strings used as possible split
- points when chunking text with the `recursive` strategy. Each
- string can be a plain string or a regular expression (regex)
- pattern. The system tries each separator in order to split the
- text, starting from the first item in the list. After splitting,
- it attempts to recombine smaller pieces into larger chunks that
- stay within the `max_chunk_size` limit, to reduce the total number
- of chunks generated.
:arg max_chunk_size: (required) The maximum size of a chunk in words.
This value cannot be higher than `300` or lower than `20` (for
`sentence` strategy) or `10` (for `word` strategy). Defaults to
`250` if omitted.
+ :arg separator_group: Only applicable to the `recursive` strategy and
+ required when using it. Sets a predefined list of separators in
+ the saved chunking settings based on the selected text type.
+ Values can be `markdown` or `plaintext`. Using this parameter is
+ an alternative to manually specifying a custom `separators` list.
+ :arg separators: Only applicable to the `recursive` strategy and
+ required when using it. A list of strings used as possible split
+ points when chunking text. Each string can be a plain string or a
+ regular expression (regex) pattern. The system tries each
+ separator in order to split the text, starting from the first item
+ in the list. After splitting, it attempts to recombine smaller
+ pieces into larger chunks that stay within the `max_chunk_size`
+ limit, to reduce the total number of chunks generated.
:arg overlap: The number of overlapping words for chunks. It is
applicable only to a `word` chunking strategy. This value cannot
be higher than half the `max_chunk_size` value. Defaults to `100`
@@ -178,9 +177,9 @@ class ChunkingSettings(AttrDict[Any]):
"""
strategy: Union[str, DefaultType]
+ max_chunk_size: Union[int, DefaultType]
separator_group: Union[str, DefaultType]
separators: Union[Sequence[str], DefaultType]
- max_chunk_size: Union[int, DefaultType]
overlap: Union[int, DefaultType]
sentence_overlap: Union[int, DefaultType]
@@ -188,21 +187,21 @@ def __init__(
self,
*,
strategy: Union[str, DefaultType] = DEFAULT,
+ max_chunk_size: Union[int, DefaultType] = DEFAULT,
separator_group: Union[str, DefaultType] = DEFAULT,
separators: Union[Sequence[str], DefaultType] = DEFAULT,
- max_chunk_size: Union[int, DefaultType] = DEFAULT,
overlap: Union[int, DefaultType] = DEFAULT,
sentence_overlap: Union[int, DefaultType] = DEFAULT,
**kwargs: Any,
):
if strategy is not DEFAULT:
kwargs["strategy"] = strategy
+ if max_chunk_size is not DEFAULT:
+ kwargs["max_chunk_size"] = max_chunk_size
if separator_group is not DEFAULT:
kwargs["separator_group"] = separator_group
if separators is not DEFAULT:
kwargs["separators"] = separators
- if max_chunk_size is not DEFAULT:
- kwargs["max_chunk_size"] = max_chunk_size
if overlap is not DEFAULT:
kwargs["overlap"] = overlap
if sentence_overlap is not DEFAULT:
@@ -4569,7 +4568,7 @@ class ArrayPercentilesItem(AttrDict[Any]):
:arg value_as_string:
"""
- key: str
+ key: float
value: Union[float, None]
value_as_string: str
@@ -5415,7 +5414,9 @@ class HdrPercentileRanksAggregate(AttrDict[Any]):
:arg meta:
"""
- values: Union[Mapping[str, Union[str, int, None]], Sequence["ArrayPercentilesItem"]]
+ values: Union[
+ Mapping[str, Union[str, float, None]], Sequence["ArrayPercentilesItem"]
+ ]
meta: Mapping[str, Any]
@@ -5425,7 +5426,9 @@ class HdrPercentilesAggregate(AttrDict[Any]):
:arg meta:
"""
- values: Union[Mapping[str, Union[str, int, None]], Sequence["ArrayPercentilesItem"]]
+ values: Union[
+ Mapping[str, Union[str, float, None]], Sequence["ArrayPercentilesItem"]
+ ]
meta: Mapping[str, Any]
@@ -5458,8 +5461,8 @@ class HistogramBucket(AttrDict[Any]):
class Hit(AttrDict[Any]):
"""
:arg index: (required)
+ :arg score: (required)
:arg id:
- :arg score:
:arg explanation:
:arg fields:
:arg highlight:
@@ -5480,8 +5483,8 @@ class Hit(AttrDict[Any]):
"""
index: str
- id: str
score: Union[float, None]
+ id: str
explanation: "Explanation"
fields: Mapping[str, Any]
highlight: Mapping[str, Sequence[str]]
@@ -5504,14 +5507,14 @@ class Hit(AttrDict[Any]):
class HitsMetadata(AttrDict[Any]):
"""
:arg hits: (required)
+ :arg max_score: (required)
:arg total: Total hit count information, present only if
`track_total_hits` wasn't `false` in the search request.
- :arg max_score:
"""
hits: Sequence["Hit"]
- total: Union["TotalHits", int]
max_score: Union[float, None]
+ total: Union["TotalHits", int]
class InferenceAggregate(AttrDict[Any]):
@@ -5932,7 +5935,9 @@ class PercentilesBucketAggregate(AttrDict[Any]):
:arg meta:
"""
- values: Union[Mapping[str, Union[str, int, None]], Sequence["ArrayPercentilesItem"]]
+ values: Union[
+ Mapping[str, Union[str, float, None]], Sequence["ArrayPercentilesItem"]
+ ]
meta: Mapping[str, Any]
@@ -6133,17 +6138,19 @@ class SearchProfile(AttrDict[Any]):
class ShardFailure(AttrDict[Any]):
"""
:arg reason: (required)
- :arg shard: (required)
:arg index:
:arg node:
+ :arg shard:
:arg status:
+ :arg primary:
"""
reason: "ErrorCause"
- shard: int
index: str
node: str
+ shard: int
status: str
+ primary: bool
class ShardProfile(AttrDict[Any]):
@@ -6467,7 +6474,9 @@ class TDigestPercentileRanksAggregate(AttrDict[Any]):
:arg meta:
"""
- values: Union[Mapping[str, Union[str, int, None]], Sequence["ArrayPercentilesItem"]]
+ values: Union[
+ Mapping[str, Union[str, float, None]], Sequence["ArrayPercentilesItem"]
+ ]
meta: Mapping[str, Any]
@@ -6477,7 +6486,9 @@ class TDigestPercentilesAggregate(AttrDict[Any]):
:arg meta:
"""
- values: Union[Mapping[str, Union[str, int, None]], Sequence["ArrayPercentilesItem"]]
+ values: Union[
+ Mapping[str, Union[str, float, None]], Sequence["ArrayPercentilesItem"]
+ ]
meta: Mapping[str, Any]