elasticsearch9 9.0.3__py3-none-any.whl → 9.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- elasticsearch9/_async/client/__init__.py +19 -6
- elasticsearch9/_async/client/cat.py +610 -26
- elasticsearch9/_async/client/esql.py +16 -6
- elasticsearch9/_async/client/indices.py +2 -2
- elasticsearch9/_async/client/sql.py +1 -1
- elasticsearch9/_async/client/transform.py +60 -0
- elasticsearch9/_sync/client/__init__.py +19 -6
- elasticsearch9/_sync/client/cat.py +610 -26
- elasticsearch9/_sync/client/esql.py +16 -6
- elasticsearch9/_sync/client/indices.py +2 -2
- elasticsearch9/_sync/client/sql.py +1 -1
- elasticsearch9/_sync/client/transform.py +60 -0
- elasticsearch9/_version.py +1 -1
- elasticsearch9/dsl/_async/document.py +84 -0
- elasticsearch9/dsl/_sync/document.py +84 -0
- elasticsearch9/dsl/document_base.py +43 -0
- elasticsearch9/dsl/field.py +23 -10
- elasticsearch9/dsl/response/aggs.py +1 -1
- elasticsearch9/dsl/types.py +20 -8
- elasticsearch9/dsl/utils.py +1 -1
- elasticsearch9/esql/__init__.py +2 -1
- elasticsearch9/esql/esql.py +85 -34
- elasticsearch9/esql/functions.py +37 -25
- {elasticsearch9-9.0.3.dist-info → elasticsearch9-9.0.4.dist-info}/METADATA +1 -3
- {elasticsearch9-9.0.3.dist-info → elasticsearch9-9.0.4.dist-info}/RECORD +28 -28
- {elasticsearch9-9.0.3.dist-info → elasticsearch9-9.0.4.dist-info}/WHEEL +0 -0
- {elasticsearch9-9.0.3.dist-info → elasticsearch9-9.0.4.dist-info}/licenses/LICENSE +0 -0
- {elasticsearch9-9.0.3.dist-info → elasticsearch9-9.0.4.dist-info}/licenses/NOTICE +0 -0
|
@@ -22,6 +22,9 @@ from elastic_transport import ObjectApiResponse
|
|
|
22
22
|
from ._base import NamespacedClient
|
|
23
23
|
from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
|
|
24
24
|
|
|
25
|
+
if t.TYPE_CHECKING:
|
|
26
|
+
from elasticsearch.esql import ESQLBase
|
|
27
|
+
|
|
25
28
|
|
|
26
29
|
class EsqlClient(NamespacedClient):
|
|
27
30
|
|
|
@@ -44,7 +47,7 @@ class EsqlClient(NamespacedClient):
|
|
|
44
47
|
async def async_query(
|
|
45
48
|
self,
|
|
46
49
|
*,
|
|
47
|
-
query: t.Optional[str] = None,
|
|
50
|
+
query: t.Optional[t.Union[str, "ESQLBase"]] = None,
|
|
48
51
|
columnar: t.Optional[bool] = None,
|
|
49
52
|
delimiter: t.Optional[str] = None,
|
|
50
53
|
drop_null_columns: t.Optional[bool] = None,
|
|
@@ -99,7 +102,12 @@ class EsqlClient(NamespacedClient):
|
|
|
99
102
|
which has the name of all the columns.
|
|
100
103
|
:param filter: Specify a Query DSL query in the filter parameter to filter the
|
|
101
104
|
set of documents that an ES|QL query runs on.
|
|
102
|
-
:param format: A short version of the Accept header,
|
|
105
|
+
:param format: A short version of the Accept header, e.g. json, yaml. `csv`,
|
|
106
|
+
`tsv`, and `txt` formats will return results in a tabular format, excluding
|
|
107
|
+
other metadata fields from the response. For async requests, nothing will
|
|
108
|
+
be returned if the async query doesn't finish within the timeout. The query
|
|
109
|
+
ID and running status are available in the `X-Elasticsearch-Async-Id` and
|
|
110
|
+
`X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively.
|
|
103
111
|
:param include_ccs_metadata: When set to `true` and performing a cross-cluster
|
|
104
112
|
query, the response will include an extra `_clusters` object with information
|
|
105
113
|
about the clusters that participated in the search along with info such as
|
|
@@ -151,7 +159,7 @@ class EsqlClient(NamespacedClient):
|
|
|
151
159
|
__query["pretty"] = pretty
|
|
152
160
|
if not __body:
|
|
153
161
|
if query is not None:
|
|
154
|
-
__body["query"] = query
|
|
162
|
+
__body["query"] = str(query)
|
|
155
163
|
if columnar is not None:
|
|
156
164
|
__body["columnar"] = columnar
|
|
157
165
|
if filter is not None:
|
|
@@ -389,7 +397,7 @@ class EsqlClient(NamespacedClient):
|
|
|
389
397
|
async def query(
|
|
390
398
|
self,
|
|
391
399
|
*,
|
|
392
|
-
query: t.Optional[str] = None,
|
|
400
|
+
query: t.Optional[t.Union[str, "ESQLBase"]] = None,
|
|
393
401
|
columnar: t.Optional[bool] = None,
|
|
394
402
|
delimiter: t.Optional[str] = None,
|
|
395
403
|
drop_null_columns: t.Optional[bool] = None,
|
|
@@ -438,7 +446,9 @@ class EsqlClient(NamespacedClient):
|
|
|
438
446
|
`all_columns` which has the name of all columns.
|
|
439
447
|
:param filter: Specify a Query DSL query in the filter parameter to filter the
|
|
440
448
|
set of documents that an ES|QL query runs on.
|
|
441
|
-
:param format: A short version of the Accept header, e.g. json, yaml.
|
|
449
|
+
:param format: A short version of the Accept header, e.g. json, yaml. `csv`,
|
|
450
|
+
`tsv`, and `txt` formats will return results in a tabular format, excluding
|
|
451
|
+
other metadata fields from the response.
|
|
442
452
|
:param include_ccs_metadata: When set to `true` and performing a cross-cluster
|
|
443
453
|
query, the response will include an extra `_clusters` object with information
|
|
444
454
|
about the clusters that participated in the search along with info such as
|
|
@@ -476,7 +486,7 @@ class EsqlClient(NamespacedClient):
|
|
|
476
486
|
__query["pretty"] = pretty
|
|
477
487
|
if not __body:
|
|
478
488
|
if query is not None:
|
|
479
|
-
__body["query"] = query
|
|
489
|
+
__body["query"] = str(query)
|
|
480
490
|
if columnar is not None:
|
|
481
491
|
__body["columnar"] = columnar
|
|
482
492
|
if filter is not None:
|
|
@@ -3715,7 +3715,7 @@ class IndicesClient(NamespacedClient):
|
|
|
3715
3715
|
<li>Change a field's mapping using reindexing</li>
|
|
3716
3716
|
<li>Rename a field using a field alias</li>
|
|
3717
3717
|
</ul>
|
|
3718
|
-
<p>Learn how to use the update mapping API with practical examples in the <a href="https://www.elastic.co/docs
|
|
3718
|
+
<p>Learn how to use the update mapping API with practical examples in the <a href="https://www.elastic.co/docs/manage-data/data-store/mapping/update-mappings-examples">Update mapping API examples</a> guide.</p>
|
|
3719
3719
|
|
|
3720
3720
|
|
|
3721
3721
|
`<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-mapping>`_
|
|
@@ -4587,7 +4587,7 @@ class IndicesClient(NamespacedClient):
|
|
|
4587
4587
|
.. raw:: html
|
|
4588
4588
|
|
|
4589
4589
|
<p>Roll over to a new index.
|
|
4590
|
-
TIP:
|
|
4590
|
+
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.</p>
|
|
4591
4591
|
<p>The rollover API creates a new index for a data stream or index alias.
|
|
4592
4592
|
The API behavior depends on the rollover target.</p>
|
|
4593
4593
|
<p><strong>Roll over a data stream</strong></p>
|
|
@@ -283,7 +283,7 @@ class SqlClient(NamespacedClient):
|
|
|
283
283
|
keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
284
284
|
keep_on_completion: t.Optional[bool] = None,
|
|
285
285
|
page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
286
|
-
params: t.Optional[t.
|
|
286
|
+
params: t.Optional[t.Sequence[t.Any]] = None,
|
|
287
287
|
pretty: t.Optional[bool] = None,
|
|
288
288
|
query: t.Optional[str] = None,
|
|
289
289
|
request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
@@ -602,6 +602,66 @@ class TransformClient(NamespacedClient):
|
|
|
602
602
|
path_parts=__path_parts,
|
|
603
603
|
)
|
|
604
604
|
|
|
605
|
+
@_rewrite_parameters()
|
|
606
|
+
async def set_upgrade_mode(
|
|
607
|
+
self,
|
|
608
|
+
*,
|
|
609
|
+
enabled: t.Optional[bool] = None,
|
|
610
|
+
error_trace: t.Optional[bool] = None,
|
|
611
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
612
|
+
human: t.Optional[bool] = None,
|
|
613
|
+
pretty: t.Optional[bool] = None,
|
|
614
|
+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
615
|
+
) -> ObjectApiResponse[t.Any]:
|
|
616
|
+
"""
|
|
617
|
+
.. raw:: html
|
|
618
|
+
|
|
619
|
+
<p>Set upgrade_mode for transform indices.
|
|
620
|
+
Sets a cluster wide upgrade_mode setting that prepares transform
|
|
621
|
+
indices for an upgrade.
|
|
622
|
+
When upgrading your cluster, in some circumstances you must restart your
|
|
623
|
+
nodes and reindex your transform indices. In those circumstances,
|
|
624
|
+
there must be no transforms running. You can close the transforms,
|
|
625
|
+
do the upgrade, then open all the transforms again. Alternatively,
|
|
626
|
+
you can use this API to temporarily halt tasks associated with the transforms
|
|
627
|
+
and prevent new transforms from opening. You can also use this API
|
|
628
|
+
during upgrades that do not require you to reindex your transform
|
|
629
|
+
indices, though stopping transforms is not a requirement in that case.
|
|
630
|
+
You can see the current value for the upgrade_mode setting by using the get
|
|
631
|
+
transform info API.</p>
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-transform-set-upgrade-mode>`_
|
|
635
|
+
|
|
636
|
+
:param enabled: When `true`, it enables `upgrade_mode` which temporarily halts
|
|
637
|
+
all transform tasks and prohibits new transform tasks from starting.
|
|
638
|
+
:param timeout: The time to wait for the request to be completed.
|
|
639
|
+
"""
|
|
640
|
+
__path_parts: t.Dict[str, str] = {}
|
|
641
|
+
__path = "/_transform/set_upgrade_mode"
|
|
642
|
+
__query: t.Dict[str, t.Any] = {}
|
|
643
|
+
if enabled is not None:
|
|
644
|
+
__query["enabled"] = enabled
|
|
645
|
+
if error_trace is not None:
|
|
646
|
+
__query["error_trace"] = error_trace
|
|
647
|
+
if filter_path is not None:
|
|
648
|
+
__query["filter_path"] = filter_path
|
|
649
|
+
if human is not None:
|
|
650
|
+
__query["human"] = human
|
|
651
|
+
if pretty is not None:
|
|
652
|
+
__query["pretty"] = pretty
|
|
653
|
+
if timeout is not None:
|
|
654
|
+
__query["timeout"] = timeout
|
|
655
|
+
__headers = {"accept": "application/json"}
|
|
656
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
657
|
+
"POST",
|
|
658
|
+
__path,
|
|
659
|
+
params=__query,
|
|
660
|
+
headers=__headers,
|
|
661
|
+
endpoint_id="transform.set_upgrade_mode",
|
|
662
|
+
path_parts=__path_parts,
|
|
663
|
+
)
|
|
664
|
+
|
|
605
665
|
@_rewrite_parameters(
|
|
606
666
|
parameter_aliases={"from": "from_"},
|
|
607
667
|
)
|
|
@@ -606,6 +606,7 @@ class Elasticsearch(BaseClient):
|
|
|
606
606
|
<li>JavaScript: Check out <code>client.helpers.*</code></li>
|
|
607
607
|
<li>.NET: Check out <code>BulkAllObservable</code></li>
|
|
608
608
|
<li>PHP: Check out bulk indexing.</li>
|
|
609
|
+
<li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
|
|
609
610
|
</ul>
|
|
610
611
|
<p><strong>Submitting bulk requests with cURL</strong></p>
|
|
611
612
|
<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>.
|
|
@@ -1324,7 +1325,7 @@ class Elasticsearch(BaseClient):
|
|
|
1324
1325
|
)
|
|
1325
1326
|
|
|
1326
1327
|
@_rewrite_parameters(
|
|
1327
|
-
body_fields=("max_docs", "query", "slice"),
|
|
1328
|
+
body_fields=("max_docs", "query", "slice", "sort"),
|
|
1328
1329
|
parameter_aliases={"from": "from_"},
|
|
1329
1330
|
)
|
|
1330
1331
|
def delete_by_query(
|
|
@@ -1368,7 +1369,12 @@ class Elasticsearch(BaseClient):
|
|
|
1368
1369
|
] = None,
|
|
1369
1370
|
slice: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
1370
1371
|
slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
|
|
1371
|
-
sort: t.Optional[
|
|
1372
|
+
sort: t.Optional[
|
|
1373
|
+
t.Union[
|
|
1374
|
+
t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
|
|
1375
|
+
t.Union[str, t.Mapping[str, t.Any]],
|
|
1376
|
+
]
|
|
1377
|
+
] = None,
|
|
1372
1378
|
stats: t.Optional[t.Sequence[str]] = None,
|
|
1373
1379
|
terminate_after: t.Optional[int] = None,
|
|
1374
1380
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
@@ -1500,7 +1506,7 @@ class Elasticsearch(BaseClient):
|
|
|
1500
1506
|
:param slice: Slice the request manually using the provided slice ID and total
|
|
1501
1507
|
number of slices.
|
|
1502
1508
|
:param slices: The number of slices this task should be divided into.
|
|
1503
|
-
:param sort: A
|
|
1509
|
+
:param sort: A sort object that specifies the order of deleted documents.
|
|
1504
1510
|
:param stats: The specific `tag` of the request for logging and statistical purposes.
|
|
1505
1511
|
:param terminate_after: The maximum number of documents to collect for each shard.
|
|
1506
1512
|
If a query reaches this limit, Elasticsearch terminates the query early.
|
|
@@ -1590,8 +1596,6 @@ class Elasticsearch(BaseClient):
|
|
|
1590
1596
|
__query["search_type"] = search_type
|
|
1591
1597
|
if slices is not None:
|
|
1592
1598
|
__query["slices"] = slices
|
|
1593
|
-
if sort is not None:
|
|
1594
|
-
__query["sort"] = sort
|
|
1595
1599
|
if stats is not None:
|
|
1596
1600
|
__query["stats"] = stats
|
|
1597
1601
|
if terminate_after is not None:
|
|
@@ -1611,6 +1615,8 @@ class Elasticsearch(BaseClient):
|
|
|
1611
1615
|
__body["query"] = query
|
|
1612
1616
|
if slice is not None:
|
|
1613
1617
|
__body["slice"] = slice
|
|
1618
|
+
if sort is not None:
|
|
1619
|
+
__body["sort"] = sort
|
|
1614
1620
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1615
1621
|
return self.perform_request( # type: ignore[return-value]
|
|
1616
1622
|
"POST",
|
|
@@ -3868,6 +3874,13 @@ class Elasticsearch(BaseClient):
|
|
|
3868
3874
|
In this case, the response includes a count of the version conflicts that were encountered.
|
|
3869
3875
|
Note that the handling of other error types is unaffected by the <code>conflicts</code> property.
|
|
3870
3876
|
Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than <code>max_docs</code> until it has successfully indexed <code>max_docs</code> documents into the target or it has gone through every document in the source query.</p>
|
|
3877
|
+
<p>It's recommended to reindex on indices with a green status. Reindexing can fail when a node shuts down or crashes.</p>
|
|
3878
|
+
<ul>
|
|
3879
|
+
<li>When requested with <code>wait_for_completion=true</code> (default), the request fails if the node shuts down.</li>
|
|
3880
|
+
<li>When requested with <code>wait_for_completion=false</code>, a task id is returned, for use with the task management APIs. The task may disappear or fail if the node shuts down.
|
|
3881
|
+
When retrying a failed reindex operation, it might be necessary to set <code>conflicts=proceed</code> or to first delete the partial destination index.
|
|
3882
|
+
Additionally, dry runs, checking disk space, and fetching index recovery information can help address the root cause.</li>
|
|
3883
|
+
</ul>
|
|
3871
3884
|
<p>Refer to the linked documentation for examples of how to reindex documents.</p>
|
|
3872
3885
|
|
|
3873
3886
|
|
|
@@ -5647,7 +5660,7 @@ class Elasticsearch(BaseClient):
|
|
|
5647
5660
|
doc: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
5648
5661
|
error_trace: t.Optional[bool] = None,
|
|
5649
5662
|
field_statistics: t.Optional[bool] = None,
|
|
5650
|
-
fields: t.Optional[t.
|
|
5663
|
+
fields: t.Optional[t.Sequence[str]] = None,
|
|
5651
5664
|
filter: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
5652
5665
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
5653
5666
|
human: t.Optional[bool] = None,
|