elasticsearch 9.1.0__py3-none-any.whl → 9.1.1__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.
Files changed (33) hide show
  1. elasticsearch/_async/client/__init__.py +19 -6
  2. elasticsearch/_async/client/cat.py +610 -26
  3. elasticsearch/_async/client/cluster.py +7 -2
  4. elasticsearch/_async/client/esql.py +20 -6
  5. elasticsearch/_async/client/indices.py +4 -4
  6. elasticsearch/_async/client/inference.py +5 -4
  7. elasticsearch/_async/client/sql.py +1 -1
  8. elasticsearch/_async/client/transform.py +60 -0
  9. elasticsearch/_sync/client/__init__.py +19 -6
  10. elasticsearch/_sync/client/cat.py +610 -26
  11. elasticsearch/_sync/client/cluster.py +7 -2
  12. elasticsearch/_sync/client/esql.py +20 -6
  13. elasticsearch/_sync/client/indices.py +4 -4
  14. elasticsearch/_sync/client/inference.py +5 -4
  15. elasticsearch/_sync/client/sql.py +1 -1
  16. elasticsearch/_sync/client/transform.py +60 -0
  17. elasticsearch/_version.py +1 -1
  18. elasticsearch/dsl/_async/document.py +84 -0
  19. elasticsearch/dsl/_sync/document.py +84 -0
  20. elasticsearch/dsl/document_base.py +42 -0
  21. elasticsearch/dsl/field.py +23 -10
  22. elasticsearch/dsl/response/aggs.py +1 -1
  23. elasticsearch/dsl/types.py +47 -10
  24. elasticsearch/dsl/utils.py +1 -1
  25. elasticsearch/esql/__init__.py +2 -1
  26. elasticsearch/esql/esql.py +85 -34
  27. elasticsearch/esql/functions.py +37 -25
  28. {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.1.dist-info}/METADATA +1 -3
  29. {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.1.dist-info}/RECORD +32 -33
  30. elasticsearch/esql/esql1.py1 +0 -307
  31. {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.1.dist-info}/WHEEL +0 -0
  32. {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.1.dist-info}/licenses/LICENSE +0 -0
  33. {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.1.dist-info}/licenses/NOTICE +0 -0
@@ -374,8 +374,13 @@ class ClusterClient(NamespacedClient):
374
374
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-get-settings>`_
375
375
 
376
376
  :param flat_settings: If `true`, returns settings in flat format.
377
- :param include_defaults: If `true`, returns default cluster settings from the
378
- local node.
377
+ :param include_defaults: If `true`, also returns default values for all other
378
+ cluster settings, reflecting the values in the `elasticsearch.yml` file of
379
+ one of the nodes in the cluster. If the nodes in your cluster do not all
380
+ have the same values in their `elasticsearch.yml` config files then the values
381
+ returned by this API may vary from invocation to invocation and may not reflect
382
+ the values that Elasticsearch uses in all situations. Use the `GET _nodes/settings`
383
+ API to fetch the settings for each individual node in your cluster.
379
384
  :param master_timeout: Period to wait for a connection to the master node. If
380
385
  no response is received before the timeout expires, the request fails and
381
386
  returns an error.
@@ -28,6 +28,9 @@ from .utils import (
28
28
  _stability_warning,
29
29
  )
30
30
 
31
+ if t.TYPE_CHECKING:
32
+ from elasticsearch.esql import ESQLBase
33
+
31
34
 
32
35
  class EsqlClient(NamespacedClient):
33
36
 
@@ -50,7 +53,7 @@ class EsqlClient(NamespacedClient):
50
53
  async def async_query(
51
54
  self,
52
55
  *,
53
- query: t.Optional[str] = None,
56
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
54
57
  allow_partial_results: t.Optional[bool] = None,
55
58
  columnar: t.Optional[bool] = None,
56
59
  delimiter: t.Optional[str] = None,
@@ -111,7 +114,12 @@ class EsqlClient(NamespacedClient):
111
114
  which has the name of all the columns.
112
115
  :param filter: Specify a Query DSL query in the filter parameter to filter the
113
116
  set of documents that an ES|QL query runs on.
114
- :param format: A short version of the Accept header, for example `json` or `yaml`.
117
+ :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
118
+ `tsv`, and `txt` formats will return results in a tabular format, excluding
119
+ other metadata fields from the response. For async requests, nothing will
120
+ be returned if the async query doesn't finish within the timeout. The query
121
+ ID and running status are available in the `X-Elasticsearch-Async-Id` and
122
+ `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively.
115
123
  :param include_ccs_metadata: When set to `true` and performing a cross-cluster
116
124
  query, the response will include an extra `_clusters` object with information
117
125
  about the clusters that participated in the search along with info such as
@@ -165,7 +173,7 @@ class EsqlClient(NamespacedClient):
165
173
  __query["pretty"] = pretty
166
174
  if not __body:
167
175
  if query is not None:
168
- __body["query"] = query
176
+ __body["query"] = str(query)
169
177
  if columnar is not None:
170
178
  __body["columnar"] = columnar
171
179
  if filter is not None:
@@ -405,6 +413,8 @@ class EsqlClient(NamespacedClient):
405
413
  Returns an object extended information about a running ES|QL query.</p>
406
414
 
407
415
 
416
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-get-query>`_
417
+
408
418
  :param id: The query ID
409
419
  """
410
420
  if id in SKIP_IN_PATH:
@@ -446,6 +456,8 @@ class EsqlClient(NamespacedClient):
446
456
  <p>Get running ES|QL queries information.
447
457
  Returns an object containing IDs and other information about the running ES|QL queries.</p>
448
458
 
459
+
460
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-list-queries>`_
449
461
  """
450
462
  __path_parts: t.Dict[str, str] = {}
451
463
  __path = "/_query/queries"
@@ -484,7 +496,7 @@ class EsqlClient(NamespacedClient):
484
496
  async def query(
485
497
  self,
486
498
  *,
487
- query: t.Optional[str] = None,
499
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
488
500
  allow_partial_results: t.Optional[bool] = None,
489
501
  columnar: t.Optional[bool] = None,
490
502
  delimiter: t.Optional[str] = None,
@@ -539,7 +551,9 @@ class EsqlClient(NamespacedClient):
539
551
  `all_columns` which has the name of all columns.
540
552
  :param filter: Specify a Query DSL query in the filter parameter to filter the
541
553
  set of documents that an ES|QL query runs on.
542
- :param format: A short version of the Accept header, e.g. json, yaml.
554
+ :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
555
+ `tsv`, and `txt` formats will return results in a tabular format, excluding
556
+ other metadata fields from the response.
543
557
  :param include_ccs_metadata: When set to `true` and performing a cross-cluster
544
558
  query, the response will include an extra `_clusters` object with information
545
559
  about the clusters that participated in the search along with info such as
@@ -579,7 +593,7 @@ class EsqlClient(NamespacedClient):
579
593
  __query["pretty"] = pretty
580
594
  if not __body:
581
595
  if query is not None:
582
- __body["query"] = query
596
+ __body["query"] = str(query)
583
597
  if columnar is not None:
584
598
  __body["columnar"] = columnar
585
599
  if filter is not None:
@@ -1208,7 +1208,7 @@ class IndicesClient(NamespacedClient):
1208
1208
  Removes the data stream options from a data stream.</p>
1209
1209
 
1210
1210
 
1211
- `<https://www.elastic.co/guide/en/elasticsearch/reference/9.1/index.html>`_
1211
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-delete-data-stream-options>`_
1212
1212
 
1213
1213
  :param name: A comma-separated list of data streams of which the data stream
1214
1214
  options will be deleted; use `*` to get all data streams
@@ -2568,7 +2568,7 @@ class IndicesClient(NamespacedClient):
2568
2568
  <p>Get the data stream options configuration of one or more data streams.</p>
2569
2569
 
2570
2570
 
2571
- `<https://www.elastic.co/guide/en/elasticsearch/reference/9.1/index.html>`_
2571
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-options>`_
2572
2572
 
2573
2573
  :param name: Comma-separated list of data streams to limit the request. Supports
2574
2574
  wildcards (`*`). To target all data streams, omit this parameter or use `*`
@@ -3684,7 +3684,7 @@ class IndicesClient(NamespacedClient):
3684
3684
  Update the data stream options of the specified data streams.</p>
3685
3685
 
3686
3686
 
3687
- `<https://www.elastic.co/guide/en/elasticsearch/reference/9.1/index.html>`_
3687
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-options>`_
3688
3688
 
3689
3689
  :param name: Comma-separated list of data streams used to limit the request.
3690
3690
  Supports wildcards (`*`). To target all data streams use `*` or `_all`.
@@ -4051,7 +4051,7 @@ class IndicesClient(NamespacedClient):
4051
4051
  <li>Change a field's mapping using reindexing</li>
4052
4052
  <li>Rename a field using a field alias</li>
4053
4053
  </ul>
4054
- <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>
4054
+ <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>
4055
4055
 
4056
4056
 
4057
4057
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-mapping>`_
@@ -396,17 +396,18 @@ class InferenceClient(NamespacedClient):
396
396
  <li>Azure AI Studio (<code>completion</code>, <code>text_embedding</code>)</li>
397
397
  <li>Azure OpenAI (<code>completion</code>, <code>text_embedding</code>)</li>
398
398
  <li>Cohere (<code>completion</code>, <code>rerank</code>, <code>text_embedding</code>)</li>
399
- <li>DeepSeek (<code>completion</code>, <code>chat_completion</code>)</li>
399
+ <li>DeepSeek (<code>chat_completion</code>, <code>completion</code>)</li>
400
400
  <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>
401
401
  <li>ELSER (<code>sparse_embedding</code>)</li>
402
402
  <li>Google AI Studio (<code>completion</code>, <code>text_embedding</code>)</li>
403
- <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>
404
404
  <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>
405
407
  <li>Mistral (<code>chat_completion</code>, <code>completion</code>, <code>text_embedding</code>)</li>
406
408
  <li>OpenAI (<code>chat_completion</code>, <code>completion</code>, <code>text_embedding</code>)</li>
407
- <li>VoyageAI (<code>text_embedding</code>, <code>rerank</code>)</li>
409
+ <li>VoyageAI (<code>rerank</code>, <code>text_embedding</code>)</li>
408
410
  <li>Watsonx inference integration (<code>text_embedding</code>)</li>
409
- <li>JinaAI (<code>text_embedding</code>, <code>rerank</code>)</li>
410
411
  </ul>
411
412
 
412
413
 
@@ -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.Mapping[str, t.Any]] = None,
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[t.Sequence[str]] = None,
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 comma-separated list of `<field>:<direction>` pairs.
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.Union[str, t.Sequence[str]]] = None,
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,