Skip to content

Commit 3e70301

Browse files
Auto-generated API code
1 parent df141d0 commit 3e70301

File tree

13 files changed

+472
-47
lines changed

13 files changed

+472
-47
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ async def bulk(
700700
<li>JavaScript: Check out <code>client.helpers.*</code></li>
701701
<li>.NET: Check out <code>BulkAllObservable</code></li>
702702
<li>PHP: Check out bulk indexing.</li>
703+
<li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
703704
</ul>
704705
<p><strong>Submitting bulk requests with cURL</strong></p>
705706
<p>If you're providing text file input to <code>curl</code>, you must use the <code>--data-binary</code> flag instead of plain <code>-d</code>.
@@ -1416,7 +1417,7 @@ async def delete(
14161417
)
14171418

14181419
@_rewrite_parameters(
1419-
body_fields=("max_docs", "query", "slice"),
1420+
body_fields=("max_docs", "query", "slice", "sort"),
14201421
parameter_aliases={"from": "from_"},
14211422
)
14221423
async def delete_by_query(
@@ -1460,7 +1461,12 @@ async def delete_by_query(
14601461
] = None,
14611462
slice: t.Optional[t.Mapping[str, t.Any]] = None,
14621463
slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
1463-
sort: t.Optional[t.Sequence[str]] = None,
1464+
sort: t.Optional[
1465+
t.Union[
1466+
t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
1467+
t.Union[str, t.Mapping[str, t.Any]],
1468+
]
1469+
] = None,
14641470
stats: t.Optional[t.Sequence[str]] = None,
14651471
terminate_after: t.Optional[int] = None,
14661472
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -1592,7 +1598,7 @@ async def delete_by_query(
15921598
:param slice: Slice the request manually using the provided slice ID and total
15931599
number of slices.
15941600
:param slices: The number of slices this task should be divided into.
1595-
:param sort: A comma-separated list of `<field>:<direction>` pairs.
1601+
:param sort: A sort object that specifies the order of deleted documents.
15961602
:param stats: The specific `tag` of the request for logging and statistical purposes.
15971603
:param terminate_after: The maximum number of documents to collect for each shard.
15981604
If a query reaches this limit, Elasticsearch terminates the query early.
@@ -1682,8 +1688,6 @@ async def delete_by_query(
16821688
__query["search_type"] = search_type
16831689
if slices is not None:
16841690
__query["slices"] = slices
1685-
if sort is not None:
1686-
__query["sort"] = sort
16871691
if stats is not None:
16881692
__query["stats"] = stats
16891693
if terminate_after is not None:
@@ -1703,6 +1707,8 @@ async def delete_by_query(
17031707
__body["query"] = query
17041708
if slice is not None:
17051709
__body["slice"] = slice
1710+
if sort is not None:
1711+
__body["sort"] = sort
17061712
__headers = {"accept": "application/json", "content-type": "application/json"}
17071713
return await self.perform_request( # type: ignore[return-value]
17081714
"POST",
@@ -6010,7 +6016,7 @@ async def termvectors(
60106016
doc: t.Optional[t.Mapping[str, t.Any]] = None,
60116017
error_trace: t.Optional[bool] = None,
60126018
field_statistics: t.Optional[bool] = None,
6013-
fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
6019+
fields: t.Optional[t.Sequence[str]] = None,
60146020
filter: t.Optional[t.Mapping[str, t.Any]] = None,
60156021
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
60166022
human: t.Optional[bool] = None,

elasticsearch/_async/client/cluster.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,13 @@ async def get_settings(
373373
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/cluster-get-settings.html>`_
374374
375375
:param flat_settings: If `true`, returns settings in flat format.
376-
:param include_defaults: If `true`, returns default cluster settings from the
377-
local node.
376+
:param include_defaults: If `true`, also returns default values for all other
377+
cluster settings, reflecting the values in the `elasticsearch.yml` file of
378+
one of the nodes in the cluster. If the nodes in your cluster do not all
379+
have the same values in their `elasticsearch.yml` config files then the values
380+
returned by this API may vary from invocation to invocation and may not reflect
381+
the values that Elasticsearch uses in all situations. Use the `GET _nodes/settings`
382+
API to fetch the settings for each individual node in your cluster.
378383
:param master_timeout: Period to wait for a connection to the master node. If
379384
no response is received before the timeout expires, the request fails and
380385
returns an error.

elasticsearch/_async/client/esql.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class EsqlClient(NamespacedClient):
4444
async def async_query(
4545
self,
4646
*,
47-
query: t.Optional[str] = None,
47+
query: t.Optional[t.Union[str, "ESQLBase"]] = None,
4848
allow_partial_results: t.Optional[bool] = None,
4949
columnar: t.Optional[bool] = None,
5050
delimiter: t.Optional[str] = None,
@@ -107,7 +107,12 @@ async def async_query(
107107
which has the name of all the columns.
108108
:param filter: Specify a Query DSL query in the filter parameter to filter the
109109
set of documents that an ES|QL query runs on.
110-
:param format: A short version of the Accept header, for example `json` or `yaml`.
110+
:param format: A short version of the Accept header, e.g. json, yaml. `csv`,
111+
`tsv`, and `txt` formats will return results in a tabular format, excluding
112+
other metadata fields from the response. For async requests, nothing will
113+
be returned if the async query doesn't finish within the timeout. The query
114+
ID and running status are available in the `X-Elasticsearch-Async-Id` and
115+
`X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively.
111116
:param include_ccs_metadata: When set to `true` and performing a cross-cluster
112117
query, the response will include an extra `_clusters` object with information
113118
about the clusters that participated in the search along with info such as
@@ -161,7 +166,7 @@ async def async_query(
161166
__query["pretty"] = pretty
162167
if not __body:
163168
if query is not None:
164-
__body["query"] = query
169+
__body["query"] = str(query)
165170
if columnar is not None:
166171
__body["columnar"] = columnar
167172
if filter is not None:
@@ -399,7 +404,7 @@ async def async_query_stop(
399404
async def query(
400405
self,
401406
*,
402-
query: t.Optional[str] = None,
407+
query: t.Optional[t.Union[str, "ESQLBase"]] = None,
403408
allow_partial_results: t.Optional[bool] = None,
404409
columnar: t.Optional[bool] = None,
405410
delimiter: t.Optional[str] = None,
@@ -456,7 +461,9 @@ async def query(
456461
`all_columns` which has the name of all columns.
457462
:param filter: Specify a Query DSL query in the filter parameter to filter the
458463
set of documents that an ES|QL query runs on.
459-
:param format: A short version of the Accept header, e.g. json, yaml.
464+
:param format: A short version of the Accept header, e.g. json, yaml. `csv`,
465+
`tsv`, and `txt` formats will return results in a tabular format, excluding
466+
other metadata fields from the response.
460467
:param include_ccs_metadata: When set to `true` and performing a cross-cluster
461468
query, the response will include an extra `_clusters` object with information
462469
about the clusters that participated in the search along with info such as
@@ -496,7 +503,7 @@ async def query(
496503
__query["pretty"] = pretty
497504
if not __body:
498505
if query is not None:
499-
__body["query"] = query
506+
__body["query"] = str(query)
500507
if columnar is not None:
501508
__body["columnar"] = columnar
502509
if filter is not None:

elasticsearch/_async/client/inference.py

Lines changed: 112 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,21 +391,23 @@ async def put(
391391
<ul>
392392
<li>AlibabaCloud AI Search (<code>completion</code>, <code>rerank</code>, <code>sparse_embedding</code>, <code>text_embedding</code>)</li>
393393
<li>Amazon Bedrock (<code>completion</code>, <code>text_embedding</code>)</li>
394+
<li>Amazon SageMaker (<code>chat_completion</code>, <code>completion</code>, <code>rerank</code>, <code>sparse_embedding</code>, <code>text_embedding</code>)</li>
394395
<li>Anthropic (<code>completion</code>)</li>
395396
<li>Azure AI Studio (<code>completion</code>, <code>text_embedding</code>)</li>
396397
<li>Azure OpenAI (<code>completion</code>, <code>text_embedding</code>)</li>
397398
<li>Cohere (<code>completion</code>, <code>rerank</code>, <code>text_embedding</code>)</li>
398-
<li>DeepSeek (<code>completion</code>, <code>chat_completion</code>)</li>
399+
<li>DeepSeek (<code>chat_completion</code>, <code>completion</code>)</li>
399400
<li>Elasticsearch (<code>rerank</code>, <code>sparse_embedding</code>, <code>text_embedding</code> - this service is for built-in models and models uploaded through Eland)</li>
400401
<li>ELSER (<code>sparse_embedding</code>)</li>
401402
<li>Google AI Studio (<code>completion</code>, <code>text_embedding</code>)</li>
402-
<li>Google Vertex AI (<code>rerank</code>, <code>text_embedding</code>)</li>
403+
<li>Google Vertex AI (<code>chat_completion</code>, <code>completion</code>, <code>rerank</code>, <code>text_embedding</code>)</li>
403404
<li>Hugging Face (<code>chat_completion</code>, <code>completion</code>, <code>rerank</code>, <code>text_embedding</code>)</li>
405+
<li>JinaAI (<code>rerank</code>, <code>text_embedding</code>)</li>
406+
<li>Llama (<code>chat_completion</code>, <code>completion</code>, <code>text_embedding</code>)</li>
404407
<li>Mistral (<code>chat_completion</code>, <code>completion</code>, <code>text_embedding</code>)</li>
405408
<li>OpenAI (<code>chat_completion</code>, <code>completion</code>, <code>text_embedding</code>)</li>
406-
<li>VoyageAI (<code>text_embedding</code>, <code>rerank</code>)</li>
409+
<li>VoyageAI (<code>rerank</code>, <code>text_embedding</code>)</li>
407410
<li>Watsonx inference integration (<code>text_embedding</code>)</li>
408-
<li>JinaAI (<code>text_embedding</code>, <code>rerank</code>)</li>
409411
</ul>
410412
411413
@@ -659,6 +661,112 @@ async def put_amazonbedrock(
659661
path_parts=__path_parts,
660662
)
661663

664+
@_rewrite_parameters(
665+
body_fields=(
666+
"service",
667+
"service_settings",
668+
"chunking_settings",
669+
"task_settings",
670+
),
671+
)
672+
async def put_amazonsagemaker(
673+
self,
674+
*,
675+
task_type: t.Union[
676+
str,
677+
t.Literal[
678+
"chat_completion",
679+
"completion",
680+
"rerank",
681+
"sparse_embedding",
682+
"text_embedding",
683+
],
684+
],
685+
amazonsagemaker_inference_id: str,
686+
service: t.Optional[t.Union[str, t.Literal["amazon_sagemaker"]]] = None,
687+
service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
688+
chunking_settings: t.Optional[t.Mapping[str, t.Any]] = None,
689+
error_trace: t.Optional[bool] = None,
690+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
691+
human: t.Optional[bool] = None,
692+
pretty: t.Optional[bool] = None,
693+
task_settings: t.Optional[t.Mapping[str, t.Any]] = None,
694+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
695+
body: t.Optional[t.Dict[str, t.Any]] = None,
696+
) -> ObjectApiResponse[t.Any]:
697+
"""
698+
.. raw:: html
699+
700+
<p>Create an Amazon SageMaker inference endpoint.</p>
701+
<p>Create an inference endpoint to perform an inference task with the <code>amazon_sagemaker</code> service.</p>
702+
703+
704+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-amazonsagemaker>`_
705+
706+
:param task_type: The type of the inference task that the model will perform.
707+
:param amazonsagemaker_inference_id: The unique identifier of the inference endpoint.
708+
:param service: The type of service supported for the specified task type. In
709+
this case, `amazon_sagemaker`.
710+
:param service_settings: Settings used to install the inference model. These
711+
settings are specific to the `amazon_sagemaker` service and `service_settings.api`
712+
you specified.
713+
:param chunking_settings: The chunking configuration object.
714+
:param task_settings: Settings to configure the inference task. These settings
715+
are specific to the task type and `service_settings.api` you specified.
716+
:param timeout: Specifies the amount of time to wait for the inference endpoint
717+
to be created.
718+
"""
719+
if task_type in SKIP_IN_PATH:
720+
raise ValueError("Empty value passed for parameter 'task_type'")
721+
if amazonsagemaker_inference_id in SKIP_IN_PATH:
722+
raise ValueError(
723+
"Empty value passed for parameter 'amazonsagemaker_inference_id'"
724+
)
725+
if service is None and body is None:
726+
raise ValueError("Empty value passed for parameter 'service'")
727+
if service_settings is None and body is None:
728+
raise ValueError("Empty value passed for parameter 'service_settings'")
729+
__path_parts: t.Dict[str, str] = {
730+
"task_type": _quote(task_type),
731+
"amazonsagemaker_inference_id": _quote(amazonsagemaker_inference_id),
732+
}
733+
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["amazonsagemaker_inference_id"]}'
734+
__query: t.Dict[str, t.Any] = {}
735+
__body: t.Dict[str, t.Any] = body if body is not None else {}
736+
if error_trace is not None:
737+
__query["error_trace"] = error_trace
738+
if filter_path is not None:
739+
__query["filter_path"] = filter_path
740+
if human is not None:
741+
__query["human"] = human
742+
if pretty is not None:
743+
__query["pretty"] = pretty
744+
if timeout is not None:
745+
__query["timeout"] = timeout
746+
if not __body:
747+
if service is not None:
748+
__body["service"] = service
749+
if service_settings is not None:
750+
__body["service_settings"] = service_settings
751+
if chunking_settings is not None:
752+
__body["chunking_settings"] = chunking_settings
753+
if task_settings is not None:
754+
__body["task_settings"] = task_settings
755+
if not __body:
756+
__body = None # type: ignore[assignment]
757+
__headers = {"accept": "application/json"}
758+
if __body is not None:
759+
__headers["content-type"] = "application/json"
760+
return await self.perform_request( # type: ignore[return-value]
761+
"PUT",
762+
__path,
763+
params=__query,
764+
headers=__headers,
765+
body=__body,
766+
endpoint_id="inference.put_amazonsagemaker",
767+
path_parts=__path_parts,
768+
)
769+
662770
@_rewrite_parameters(
663771
body_fields=(
664772
"service",

elasticsearch/_async/client/sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ async def query(
283283
keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
284284
keep_on_completion: t.Optional[bool] = None,
285285
page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
286-
params: t.Optional[t.Mapping[str, t.Any]] = None,
286+
params: t.Optional[t.Sequence[t.Any]] = None,
287287
pretty: t.Optional[bool] = None,
288288
query: t.Optional[str] = None,
289289
request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,

elasticsearch/_sync/client/__init__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ def bulk(
698698
<li>JavaScript: Check out <code>client.helpers.*</code></li>
699699
<li>.NET: Check out <code>BulkAllObservable</code></li>
700700
<li>PHP: Check out bulk indexing.</li>
701+
<li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
701702
</ul>
702703
<p><strong>Submitting bulk requests with cURL</strong></p>
703704
<p>If you're providing text file input to <code>curl</code>, you must use the <code>--data-binary</code> flag instead of plain <code>-d</code>.
@@ -1414,7 +1415,7 @@ def delete(
14141415
)
14151416

14161417
@_rewrite_parameters(
1417-
body_fields=("max_docs", "query", "slice"),
1418+
body_fields=("max_docs", "query", "slice", "sort"),
14181419
parameter_aliases={"from": "from_"},
14191420
)
14201421
def delete_by_query(
@@ -1458,7 +1459,12 @@ def delete_by_query(
14581459
] = None,
14591460
slice: t.Optional[t.Mapping[str, t.Any]] = None,
14601461
slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
1461-
sort: t.Optional[t.Sequence[str]] = None,
1462+
sort: t.Optional[
1463+
t.Union[
1464+
t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
1465+
t.Union[str, t.Mapping[str, t.Any]],
1466+
]
1467+
] = None,
14621468
stats: t.Optional[t.Sequence[str]] = None,
14631469
terminate_after: t.Optional[int] = None,
14641470
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -1590,7 +1596,7 @@ def delete_by_query(
15901596
:param slice: Slice the request manually using the provided slice ID and total
15911597
number of slices.
15921598
:param slices: The number of slices this task should be divided into.
1593-
:param sort: A comma-separated list of `<field>:<direction>` pairs.
1599+
:param sort: A sort object that specifies the order of deleted documents.
15941600
:param stats: The specific `tag` of the request for logging and statistical purposes.
15951601
:param terminate_after: The maximum number of documents to collect for each shard.
15961602
If a query reaches this limit, Elasticsearch terminates the query early.
@@ -1680,8 +1686,6 @@ def delete_by_query(
16801686
__query["search_type"] = search_type
16811687
if slices is not None:
16821688
__query["slices"] = slices
1683-
if sort is not None:
1684-
__query["sort"] = sort
16851689
if stats is not None:
16861690
__query["stats"] = stats
16871691
if terminate_after is not None:
@@ -1701,6 +1705,8 @@ def delete_by_query(
17011705
__body["query"] = query
17021706
if slice is not None:
17031707
__body["slice"] = slice
1708+
if sort is not None:
1709+
__body["sort"] = sort
17041710
__headers = {"accept": "application/json", "content-type": "application/json"}
17051711
return self.perform_request( # type: ignore[return-value]
17061712
"POST",
@@ -6008,7 +6014,7 @@ def termvectors(
60086014
doc: t.Optional[t.Mapping[str, t.Any]] = None,
60096015
error_trace: t.Optional[bool] = None,
60106016
field_statistics: t.Optional[bool] = None,
6011-
fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
6017+
fields: t.Optional[t.Sequence[str]] = None,
60126018
filter: t.Optional[t.Mapping[str, t.Any]] = None,
60136019
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
60146020
human: t.Optional[bool] = None,

elasticsearch/_sync/client/cluster.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,13 @@ def get_settings(
373373
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/cluster-get-settings.html>`_
374374
375375
:param flat_settings: If `true`, returns settings in flat format.
376-
:param include_defaults: If `true`, returns default cluster settings from the
377-
local node.
376+
:param include_defaults: If `true`, also returns default values for all other
377+
cluster settings, reflecting the values in the `elasticsearch.yml` file of
378+
one of the nodes in the cluster. If the nodes in your cluster do not all
379+
have the same values in their `elasticsearch.yml` config files then the values
380+
returned by this API may vary from invocation to invocation and may not reflect
381+
the values that Elasticsearch uses in all situations. Use the `GET _nodes/settings`
382+
API to fetch the settings for each individual node in your cluster.
378383
:param master_timeout: Period to wait for a connection to the master node. If
379384
no response is received before the timeout expires, the request fails and
380385
returns an error.

0 commit comments

Comments
 (0)