Skip to content

Commit 335154e

Browse files
Auto-generated code for 9.1 (elastic#3072)
* Auto-generated API code * streams namespace * using fixed generator * update schema version * more references to new namespaces --------- Co-authored-by: Miguel Grinberg <[email protected]>
1 parent ca7a7ba commit 335154e

31 files changed

+1796
-140
lines changed

docs/sphinx/api/indices.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Indices
66
:no-index:
77

88
.. autoclass:: IndicesClient
9-
:members:
9+
:members:

docs/sphinx/api/streams.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. _streams:
2+
3+
Streams
4+
-------
5+
.. py:module:: elasticsearch.client
6+
:no-index:
7+
8+
.. autoclass:: StreamsClient
9+
:members:

docs/sphinx/es_api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ arguments are required for all calls.
5050
api/snapshots
5151
api/snapshottable-features
5252
api/sql
53+
api/streams
5354
api/synonyms
5455
api/tls-ssl
5556
api/tasks

elasticsearch/_async/client/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
from .snapshot import SnapshotClient
7575
from .sql import SqlClient
7676
from .ssl import SslClient
77+
from .streams import StreamsClient
7778
from .synonyms import SynonymsClient
7879
from .tasks import TasksClient
7980
from .text_structure import TextStructureClient
@@ -378,6 +379,7 @@ def __init__(
378379
self.shutdown = ShutdownClient(self)
379380
self.sql = SqlClient(self)
380381
self.ssl = SslClient(self)
382+
self.streams = StreamsClient(self)
381383
self.synonyms = SynonymsClient(self)
382384
self.text_structure = TextStructureClient(self)
383385
self.transform = TransformClient(self)

elasticsearch/_async/client/cat.py

Lines changed: 481 additions & 25 deletions
Large diffs are not rendered by default.

elasticsearch/_async/client/connector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async def delete(
103103
104104
:param connector_id: The unique identifier of the connector to be deleted
105105
:param delete_sync_jobs: A flag indicating if associated sync jobs should be
106-
also removed. Defaults to false.
106+
also removed.
107107
:param hard: A flag indicating if the connector should be hard deleted.
108108
"""
109109
if connector_id in SKIP_IN_PATH:
@@ -360,7 +360,7 @@ async def list(
360360
361361
:param connector_name: A comma-separated list of connector names to fetch connector
362362
documents for
363-
:param from_: Starting offset (default: 0)
363+
:param from_: Starting offset
364364
:param include_deleted: A flag to indicate if the desired connector should be
365365
fetched, even if it was soft-deleted.
366366
:param index_name: A comma-separated list of connector index names to fetch connector
@@ -955,7 +955,7 @@ async def sync_job_list(
955955
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-connector-sync-job-list>`_
956956
957957
:param connector_id: A connector id to fetch connector sync jobs for
958-
:param from_: Starting offset (default: 0)
958+
:param from_: Starting offset
959959
:param job_type: A comma-separated list of job types to fetch the sync jobs for
960960
:param size: Specifies a max number of results to get
961961
:param status: A sync job status to fetch connector sync jobs for

elasticsearch/_async/client/indices.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,7 @@ async def create_from(
812812
raise ValueError("Empty value passed for parameter 'source'")
813813
if dest in SKIP_IN_PATH:
814814
raise ValueError("Empty value passed for parameter 'dest'")
815-
if create_from is None and body is None:
816-
raise ValueError(
817-
"Empty value passed for parameters 'create_from' and 'body', one of them should be set."
818-
)
819-
elif create_from is not None and body is not None:
815+
if create_from is not None and body is not None:
820816
raise ValueError("Cannot set both 'create_from' and 'body'")
821817
__path_parts: t.Dict[str, str] = {
822818
"source": _quote(source),
@@ -833,7 +829,11 @@ async def create_from(
833829
if pretty is not None:
834830
__query["pretty"] = pretty
835831
__body = create_from if create_from is not None else body
836-
__headers = {"accept": "application/json", "content-type": "application/json"}
832+
if not __body:
833+
__body = None
834+
__headers = {"accept": "application/json"}
835+
if __body is not None:
836+
__headers["content-type"] = "application/json"
837837
return await self.perform_request( # type: ignore[return-value]
838838
"PUT",
839839
__path,
@@ -4549,6 +4549,7 @@ async def refresh(
45494549
For data streams, the API runs the refresh operation on the stream’s backing indices.</p>
45504550
<p>By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds.
45514551
You can change this default interval with the <code>index.refresh_interval</code> setting.</p>
4552+
<p>In Elastic Cloud Serverless, the default refresh interval is 5 seconds across all indices.</p>
45524553
<p>Refresh requests are synchronous and do not return a response until the refresh operation completes.</p>
45534554
<p>Refreshes are resource-intensive.
45544555
To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.</p>
@@ -5414,7 +5415,9 @@ async def shrink(
54145415
path_parts=__path_parts,
54155416
)
54165417

5417-
@_rewrite_parameters()
5418+
@_rewrite_parameters(
5419+
body_name="index_template",
5420+
)
54185421
async def simulate_index_template(
54195422
self,
54205423
*,
@@ -5425,6 +5428,8 @@ async def simulate_index_template(
54255428
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
54265429
human: t.Optional[bool] = None,
54275430
include_defaults: t.Optional[bool] = None,
5431+
index_template: t.Optional[t.Mapping[str, t.Any]] = None,
5432+
body: t.Optional[t.Mapping[str, t.Any]] = None,
54285433
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
54295434
pretty: t.Optional[bool] = None,
54305435
) -> ObjectApiResponse[t.Any]:
@@ -5444,12 +5449,15 @@ async def simulate_index_template(
54445449
only be dry-run added if new or can also replace an existing one
54455450
:param include_defaults: If true, returns all relevant default configurations
54465451
for the index template.
5452+
:param index_template:
54475453
:param master_timeout: Period to wait for a connection to the master node. If
54485454
no response is received before the timeout expires, the request fails and
54495455
returns an error.
54505456
"""
54515457
if name in SKIP_IN_PATH:
54525458
raise ValueError("Empty value passed for parameter 'name'")
5459+
if index_template is not None and body is not None:
5460+
raise ValueError("Cannot set both 'index_template' and 'body'")
54535461
__path_parts: t.Dict[str, str] = {"name": _quote(name)}
54545462
__path = f'/_index_template/_simulate_index/{__path_parts["name"]}'
54555463
__query: t.Dict[str, t.Any] = {}
@@ -5469,12 +5477,18 @@ async def simulate_index_template(
54695477
__query["master_timeout"] = master_timeout
54705478
if pretty is not None:
54715479
__query["pretty"] = pretty
5480+
__body = index_template if index_template is not None else body
5481+
if not __body:
5482+
__body = None
54725483
__headers = {"accept": "application/json"}
5484+
if __body is not None:
5485+
__headers["content-type"] = "application/json"
54735486
return await self.perform_request( # type: ignore[return-value]
54745487
"POST",
54755488
__path,
54765489
params=__query,
54775490
headers=__headers,
5491+
body=__body,
54785492
endpoint_id="indices.simulate_index_template",
54795493
path_parts=__path_parts,
54805494
)
@@ -5823,8 +5837,8 @@ async def stats(
58235837
are requested).
58245838
:param include_unloaded_segments: If true, the response includes information
58255839
from segments that are not loaded into memory.
5826-
:param level: Indicates whether statistics are aggregated at the cluster, index,
5827-
or shard level.
5840+
:param level: Indicates whether statistics are aggregated at the cluster, indices,
5841+
or shards level.
58285842
"""
58295843
__path_parts: t.Dict[str, str]
58305844
if index not in SKIP_IN_PATH and metric not in SKIP_IN_PATH:

elasticsearch/_async/client/inference.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2504,7 +2504,7 @@ async def sparse_embedding(
25042504
)
25052505

25062506
@_rewrite_parameters(
2507-
body_fields=("input", "task_settings"),
2507+
body_fields=("input", "input_type", "task_settings"),
25082508
)
25092509
async def text_embedding(
25102510
self,
@@ -2514,6 +2514,7 @@ async def text_embedding(
25142514
error_trace: t.Optional[bool] = None,
25152515
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
25162516
human: t.Optional[bool] = None,
2517+
input_type: t.Optional[str] = None,
25172518
pretty: t.Optional[bool] = None,
25182519
task_settings: t.Optional[t.Any] = None,
25192520
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -2529,6 +2530,13 @@ async def text_embedding(
25292530
25302531
:param inference_id: The inference Id
25312532
:param input: Inference input. Either a string or an array of strings.
2533+
:param input_type: The input data type for the text embedding model. Possible
2534+
values include: * `SEARCH` * `INGEST` * `CLASSIFICATION` * `CLUSTERING` Not
2535+
all services support all values. Unsupported values will trigger a validation
2536+
exception. Accepted values depend on the configured inference service, refer
2537+
to the relevant service-specific documentation for more info. > info > The
2538+
`input_type` parameter specified on the root level of the request body will
2539+
take precedence over the `input_type` parameter specified in `task_settings`.
25322540
:param task_settings: Optional task settings
25332541
:param timeout: Specifies the amount of time to wait for the inference request
25342542
to complete.
@@ -2554,6 +2562,8 @@ async def text_embedding(
25542562
if not __body:
25552563
if input is not None:
25562564
__body["input"] = input
2565+
if input_type is not None:
2566+
__body["input_type"] = input_type
25572567
if task_settings is not None:
25582568
__body["task_settings"] = task_settings
25592569
if not __body:

elasticsearch/_async/client/logstash.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ async def put_pipeline(
141141
142142
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-logstash-put-pipeline>`_
143143
144-
:param id: An identifier for the pipeline.
144+
:param id: An identifier for the pipeline. Pipeline IDs must begin with a letter
145+
or underscore and contain only letters, underscores, dashes, hyphens and
146+
numbers.
145147
:param pipeline:
146148
"""
147149
if id in SKIP_IN_PATH:

elasticsearch/_async/client/nodes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,8 @@ async def stats(
404404
are requested).
405405
:param include_unloaded_segments: If `true`, the response includes information
406406
from segments that are not loaded into memory.
407-
:param level: Indicates whether statistics are aggregated at the cluster, index,
408-
or shard level.
407+
:param level: Indicates whether statistics are aggregated at the node, indices,
408+
or shards level.
409409
:param timeout: Period to wait for a response. If no response is received before
410410
the timeout expires, the request fails and returns an error.
411411
:param types: A comma-separated list of document types for the indexing index

0 commit comments

Comments
 (0)