elasticsearch 9.2.0__py3-none-any.whl → 9.3.0__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 (125) hide show
  1. elasticsearch/_async/client/__init__.py +108 -85
  2. elasticsearch/_async/client/async_search.py +7 -6
  3. elasticsearch/_async/client/autoscaling.py +15 -4
  4. elasticsearch/_async/client/cat.py +203 -10
  5. elasticsearch/_async/client/ccr.py +10 -10
  6. elasticsearch/_async/client/cluster.py +98 -66
  7. elasticsearch/_async/client/connector.py +42 -41
  8. elasticsearch/_async/client/dangling_indices.py +8 -12
  9. elasticsearch/_async/client/enrich.py +10 -10
  10. elasticsearch/_async/client/eql.py +17 -16
  11. elasticsearch/_async/client/esql.py +173 -24
  12. elasticsearch/_async/client/features.py +6 -6
  13. elasticsearch/_async/client/fleet.py +8 -8
  14. elasticsearch/_async/client/graph.py +3 -3
  15. elasticsearch/_async/client/ilm.py +18 -18
  16. elasticsearch/_async/client/indices.py +564 -149
  17. elasticsearch/_async/client/inference.py +374 -64
  18. elasticsearch/_async/client/ingest.py +9 -9
  19. elasticsearch/_async/client/license.py +5 -7
  20. elasticsearch/_async/client/logstash.py +4 -4
  21. elasticsearch/_async/client/migration.py +6 -6
  22. elasticsearch/_async/client/ml.py +132 -88
  23. elasticsearch/_async/client/monitoring.py +4 -3
  24. elasticsearch/_async/client/nodes.py +182 -20
  25. elasticsearch/_async/client/project.py +13 -4
  26. elasticsearch/_async/client/query_rules.py +16 -16
  27. elasticsearch/_async/client/rollup.py +21 -21
  28. elasticsearch/_async/client/search_application.py +19 -19
  29. elasticsearch/_async/client/searchable_snapshots.py +10 -10
  30. elasticsearch/_async/client/security.py +34 -10
  31. elasticsearch/_async/client/shutdown.py +15 -4
  32. elasticsearch/_async/client/simulate.py +4 -4
  33. elasticsearch/_async/client/slm.py +17 -17
  34. elasticsearch/_async/client/snapshot.py +21 -21
  35. elasticsearch/_async/client/sql.py +17 -16
  36. elasticsearch/_async/client/streams.py +6 -7
  37. elasticsearch/_async/client/synonyms.py +10 -10
  38. elasticsearch/_async/client/tasks.py +8 -8
  39. elasticsearch/_async/client/text_structure.py +16 -12
  40. elasticsearch/_async/client/transform.py +51 -12
  41. elasticsearch/_async/client/utils.py +4 -2
  42. elasticsearch/_async/client/watcher.py +26 -26
  43. elasticsearch/_async/client/xpack.py +6 -5
  44. elasticsearch/_sync/client/__init__.py +110 -85
  45. elasticsearch/_sync/client/async_search.py +7 -6
  46. elasticsearch/_sync/client/autoscaling.py +15 -4
  47. elasticsearch/_sync/client/cat.py +203 -10
  48. elasticsearch/_sync/client/ccr.py +10 -10
  49. elasticsearch/_sync/client/cluster.py +98 -66
  50. elasticsearch/_sync/client/connector.py +42 -41
  51. elasticsearch/_sync/client/dangling_indices.py +8 -12
  52. elasticsearch/_sync/client/enrich.py +10 -10
  53. elasticsearch/_sync/client/eql.py +17 -16
  54. elasticsearch/_sync/client/esql.py +173 -24
  55. elasticsearch/_sync/client/features.py +6 -6
  56. elasticsearch/_sync/client/fleet.py +8 -8
  57. elasticsearch/_sync/client/graph.py +3 -3
  58. elasticsearch/_sync/client/ilm.py +18 -18
  59. elasticsearch/_sync/client/indices.py +564 -149
  60. elasticsearch/_sync/client/inference.py +374 -64
  61. elasticsearch/_sync/client/ingest.py +9 -9
  62. elasticsearch/_sync/client/license.py +5 -7
  63. elasticsearch/_sync/client/logstash.py +4 -4
  64. elasticsearch/_sync/client/migration.py +6 -6
  65. elasticsearch/_sync/client/ml.py +132 -88
  66. elasticsearch/_sync/client/monitoring.py +4 -3
  67. elasticsearch/_sync/client/nodes.py +182 -20
  68. elasticsearch/_sync/client/project.py +13 -4
  69. elasticsearch/_sync/client/project_routing.py +264 -0
  70. elasticsearch/_sync/client/query_rules.py +16 -16
  71. elasticsearch/_sync/client/rollup.py +21 -21
  72. elasticsearch/_sync/client/search_application.py +19 -19
  73. elasticsearch/_sync/client/searchable_snapshots.py +10 -10
  74. elasticsearch/_sync/client/security.py +34 -10
  75. elasticsearch/_sync/client/shutdown.py +15 -4
  76. elasticsearch/_sync/client/simulate.py +4 -4
  77. elasticsearch/_sync/client/slm.py +17 -17
  78. elasticsearch/_sync/client/snapshot.py +21 -21
  79. elasticsearch/_sync/client/sql.py +17 -16
  80. elasticsearch/_sync/client/streams.py +6 -7
  81. elasticsearch/_sync/client/synonyms.py +10 -10
  82. elasticsearch/_sync/client/tasks.py +8 -8
  83. elasticsearch/_sync/client/text_structure.py +16 -12
  84. elasticsearch/_sync/client/transform.py +51 -12
  85. elasticsearch/_sync/client/utils.py +16 -2
  86. elasticsearch/_sync/client/watcher.py +26 -26
  87. elasticsearch/_sync/client/xpack.py +6 -5
  88. elasticsearch/_version.py +2 -2
  89. elasticsearch/dsl/__init__.py +4 -0
  90. elasticsearch/dsl/_async/document.py +4 -5
  91. elasticsearch/dsl/_async/index.py +1 -1
  92. elasticsearch/dsl/_async/search.py +2 -3
  93. elasticsearch/dsl/_sync/document.py +4 -5
  94. elasticsearch/dsl/_sync/index.py +1 -1
  95. elasticsearch/dsl/_sync/search.py +2 -3
  96. elasticsearch/dsl/aggs.py +9 -9
  97. elasticsearch/dsl/async_connections.py +1 -2
  98. elasticsearch/dsl/connections.py +1 -2
  99. elasticsearch/dsl/document_base.py +1 -1
  100. elasticsearch/dsl/field.py +90 -6
  101. elasticsearch/dsl/pydantic.py +1 -1
  102. elasticsearch/dsl/query.py +25 -2
  103. elasticsearch/dsl/response/__init__.py +2 -0
  104. elasticsearch/dsl/serializer.py +1 -2
  105. elasticsearch/dsl/types.py +63 -8
  106. elasticsearch/dsl/utils.py +12 -4
  107. elasticsearch/esql/esql.py +1 -1
  108. elasticsearch/esql/functions.py +926 -252
  109. elasticsearch/helpers/__init__.py +2 -0
  110. elasticsearch/helpers/actions.py +21 -0
  111. elasticsearch/helpers/vectorstore/__init__.py +7 -7
  112. elasticsearch/helpers/vectorstore/_async/_utils.py +1 -1
  113. elasticsearch/helpers/vectorstore/_async/embedding_service.py +2 -2
  114. elasticsearch/helpers/vectorstore/_async/strategies.py +3 -3
  115. elasticsearch/helpers/vectorstore/_async/vectorstore.py +8 -5
  116. elasticsearch/helpers/vectorstore/_sync/_utils.py +1 -1
  117. elasticsearch/helpers/vectorstore/_sync/embedding_service.py +2 -2
  118. elasticsearch/helpers/vectorstore/_sync/strategies.py +3 -3
  119. elasticsearch/helpers/vectorstore/_sync/vectorstore.py +8 -5
  120. {elasticsearch-9.2.0.dist-info → elasticsearch-9.3.0.dist-info}/METADATA +2 -1
  121. elasticsearch-9.3.0.dist-info/RECORD +169 -0
  122. {elasticsearch-9.2.0.dist-info → elasticsearch-9.3.0.dist-info}/WHEEL +1 -1
  123. elasticsearch-9.2.0.dist-info/RECORD +0 -168
  124. {elasticsearch-9.2.0.dist-info → elasticsearch-9.3.0.dist-info}/licenses/LICENSE +0 -0
  125. {elasticsearch-9.2.0.dist-info → elasticsearch-9.3.0.dist-info}/licenses/NOTICE +0 -0
@@ -85,9 +85,9 @@ from .utils import (
85
85
  CLIENT_META_SERVICE,
86
86
  SKIP_IN_PATH,
87
87
  Stability,
88
+ _availability_warning,
88
89
  _quote,
89
90
  _rewrite_parameters,
90
- _stability_warning,
91
91
  client_node_configs,
92
92
  is_requests_http_auth,
93
93
  is_requests_node_class,
@@ -504,6 +504,7 @@ class Elasticsearch(BaseClient):
504
504
  """
505
505
  __path = "/"
506
506
  __query: t.Dict[str, t.Any] = {}
507
+ __path_parts: t.Dict[str, str] = {}
507
508
  if error_trace is not None:
508
509
  __query["error_trace"] = error_trace
509
510
  if filter_path is not None:
@@ -514,7 +515,14 @@ class Elasticsearch(BaseClient):
514
515
  __query["pretty"] = pretty
515
516
  __headers = {"accept": "application/json"}
516
517
  try:
517
- self.perform_request("HEAD", __path, params=__query, headers=__headers)
518
+ self.perform_request(
519
+ "HEAD",
520
+ __path,
521
+ params=__query,
522
+ headers=__headers,
523
+ endpoint_id="ping",
524
+ path_parts=__path_parts,
525
+ )
518
526
  return True
519
527
  except (ApiError, TransportError):
520
528
  return False
@@ -547,7 +555,7 @@ class Elasticsearch(BaseClient):
547
555
  ] = None,
548
556
  require_alias: t.Optional[bool] = None,
549
557
  require_data_stream: t.Optional[bool] = None,
550
- routing: t.Optional[str] = None,
558
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
551
559
  source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None,
552
560
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
553
561
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
@@ -559,8 +567,8 @@ class Elasticsearch(BaseClient):
559
567
  """
560
568
  .. raw:: html
561
569
 
562
- <p>Bulk index or delete documents.
563
- Perform multiple <code>index</code>, <code>create</code>, <code>delete</code>, and <code>update</code> actions in a single request.
570
+ <p>Bulk index or delete documents.</p>
571
+ <p>Perform multiple <code>index</code>, <code>create</code>, <code>delete</code>, and <code>update</code> actions in a single request.
564
572
  This reduces overhead and can greatly increase indexing speed.</p>
565
573
  <p>If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:</p>
566
574
  <ul>
@@ -608,6 +616,7 @@ class Elasticsearch(BaseClient):
608
616
  <li>Perl: Check out <code>Search::Elasticsearch::Client::5_0::Bulk</code> and <code>Search::Elasticsearch::Client::5_0::Scroll</code></li>
609
617
  <li>Python: Check out <code>elasticsearch.helpers.*</code></li>
610
618
  <li>JavaScript: Check out <code>client.helpers.*</code></li>
619
+ <li>Java: Check out <code>co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester</code></li>
611
620
  <li>.NET: Check out <code>BulkAllObservable</code></li>
612
621
  <li>PHP: Check out bulk indexing.</li>
613
622
  <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
@@ -765,8 +774,8 @@ class Elasticsearch(BaseClient):
765
774
  """
766
775
  .. raw:: html
767
776
 
768
- <p>Clear a scrolling search.
769
- Clear the search context and results for a scrolling search.</p>
777
+ <p>Clear a scrolling search.</p>
778
+ <p>Clear the search context and results for a scrolling search.</p>
770
779
 
771
780
 
772
781
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-clear-scroll>`_
@@ -819,8 +828,8 @@ class Elasticsearch(BaseClient):
819
828
  """
820
829
  .. raw:: html
821
830
 
822
- <p>Close a point in time.
823
- A point in time must be opened explicitly before being used in search requests.
831
+ <p>Close a point in time.</p>
832
+ <p>A point in time must be opened explicitly before being used in search requests.
824
833
  The <code>keep_alive</code> parameter tells Elasticsearch how long it should persist.
825
834
  A point in time is automatically closed when the <code>keep_alive</code> period has elapsed.
826
835
  However, keeping points in time has a cost; close them as soon as they are no longer required for search requests.</p>
@@ -859,7 +868,7 @@ class Elasticsearch(BaseClient):
859
868
  )
860
869
 
861
870
  @_rewrite_parameters(
862
- body_fields=("query",),
871
+ body_fields=("project_routing", "query"),
863
872
  )
864
873
  def count(
865
874
  self,
@@ -890,15 +899,15 @@ class Elasticsearch(BaseClient):
890
899
  project_routing: t.Optional[str] = None,
891
900
  q: t.Optional[str] = None,
892
901
  query: t.Optional[t.Mapping[str, t.Any]] = None,
893
- routing: t.Optional[str] = None,
902
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
894
903
  terminate_after: t.Optional[int] = None,
895
904
  body: t.Optional[t.Dict[str, t.Any]] = None,
896
905
  ) -> ObjectApiResponse[t.Any]:
897
906
  """
898
907
  .. raw:: html
899
908
 
900
- <p>Count search results.
901
- Get the number of documents matching a query.</p>
909
+ <p>Count search results.</p>
910
+ <p>Get the number of documents matching a query.</p>
902
911
  <p>The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body.
903
912
  The query is optional. When no query is provided, the API uses <code>match_all</code> to count all the documents.</p>
904
913
  <p>The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices.</p>
@@ -942,10 +951,10 @@ class Elasticsearch(BaseClient):
942
951
  in the result.
943
952
  :param preference: The node or shard the operation should be performed on. By
944
953
  default, it is random.
945
- :param project_routing: Specifies a subset of projects to target for the search
946
- using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
947
- queries: the _alias tag and a single value (possibly wildcarded). Examples:
948
- _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
954
+ :param project_routing: Specifies a subset of projects to target using project
955
+ metadata tags in a subset of Lucene query syntax. Allowed Lucene queries:
956
+ the _alias tag and a single value (possibly wildcarded). Examples: _alias:my-project
957
+ _alias:_origin _alias:*pr* Supported in serverless only.
949
958
  :param q: The query in Lucene query string syntax. This parameter cannot be used
950
959
  with a request body.
951
960
  :param query: Defines the search query using Query DSL. A request body query
@@ -998,8 +1007,6 @@ class Elasticsearch(BaseClient):
998
1007
  __query["preference"] = preference
999
1008
  if pretty is not None:
1000
1009
  __query["pretty"] = pretty
1001
- if project_routing is not None:
1002
- __query["project_routing"] = project_routing
1003
1010
  if q is not None:
1004
1011
  __query["q"] = q
1005
1012
  if routing is not None:
@@ -1007,6 +1014,8 @@ class Elasticsearch(BaseClient):
1007
1014
  if terminate_after is not None:
1008
1015
  __query["terminate_after"] = terminate_after
1009
1016
  if not __body:
1017
+ if project_routing is not None:
1018
+ __body["project_routing"] = project_routing
1010
1019
  if query is not None:
1011
1020
  __body["query"] = query
1012
1021
  if not __body:
@@ -1045,7 +1054,7 @@ class Elasticsearch(BaseClient):
1045
1054
  ] = None,
1046
1055
  require_alias: t.Optional[bool] = None,
1047
1056
  require_data_stream: t.Optional[bool] = None,
1048
- routing: t.Optional[str] = None,
1057
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1049
1058
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1050
1059
  version: t.Optional[int] = None,
1051
1060
  version_type: t.Optional[
@@ -1224,7 +1233,7 @@ class Elasticsearch(BaseClient):
1224
1233
  refresh: t.Optional[
1225
1234
  t.Union[bool, str, t.Literal["false", "true", "wait_for"]]
1226
1235
  ] = None,
1227
- routing: t.Optional[str] = None,
1236
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1228
1237
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1229
1238
  version: t.Optional[int] = None,
1230
1239
  version_type: t.Optional[
@@ -1367,7 +1376,7 @@ class Elasticsearch(BaseClient):
1367
1376
  refresh: t.Optional[bool] = None,
1368
1377
  request_cache: t.Optional[bool] = None,
1369
1378
  requests_per_second: t.Optional[float] = None,
1370
- routing: t.Optional[str] = None,
1379
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1371
1380
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1372
1381
  scroll_size: t.Optional[int] = None,
1373
1382
  search_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -1640,11 +1649,11 @@ class Elasticsearch(BaseClient):
1640
1649
  self,
1641
1650
  *,
1642
1651
  task_id: str,
1652
+ requests_per_second: float,
1643
1653
  error_trace: t.Optional[bool] = None,
1644
1654
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1645
1655
  human: t.Optional[bool] = None,
1646
1656
  pretty: t.Optional[bool] = None,
1647
- requests_per_second: t.Optional[float] = None,
1648
1657
  ) -> ObjectApiResponse[t.Any]:
1649
1658
  """
1650
1659
  .. raw:: html
@@ -1662,9 +1671,13 @@ class Elasticsearch(BaseClient):
1662
1671
  """
1663
1672
  if task_id in SKIP_IN_PATH:
1664
1673
  raise ValueError("Empty value passed for parameter 'task_id'")
1674
+ if requests_per_second is None:
1675
+ raise ValueError("Empty value passed for parameter 'requests_per_second'")
1665
1676
  __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)}
1666
1677
  __path = f'/_delete_by_query/{__path_parts["task_id"]}/_rethrottle'
1667
1678
  __query: t.Dict[str, t.Any] = {}
1679
+ if requests_per_second is not None:
1680
+ __query["requests_per_second"] = requests_per_second
1668
1681
  if error_trace is not None:
1669
1682
  __query["error_trace"] = error_trace
1670
1683
  if filter_path is not None:
@@ -1673,8 +1686,6 @@ class Elasticsearch(BaseClient):
1673
1686
  __query["human"] = human
1674
1687
  if pretty is not None:
1675
1688
  __query["pretty"] = pretty
1676
- if requests_per_second is not None:
1677
- __query["requests_per_second"] = requests_per_second
1678
1689
  __headers = {"accept": "application/json"}
1679
1690
  return self.perform_request( # type: ignore[return-value]
1680
1691
  "POST",
@@ -1700,8 +1711,8 @@ class Elasticsearch(BaseClient):
1700
1711
  """
1701
1712
  .. raw:: html
1702
1713
 
1703
- <p>Delete a script or search template.
1704
- Deletes a stored script or search template.</p>
1714
+ <p>Delete a script or search template.</p>
1715
+ <p>Deletes a stored script or search template.</p>
1705
1716
 
1706
1717
 
1707
1718
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-delete-script>`_
@@ -1761,7 +1772,7 @@ class Elasticsearch(BaseClient):
1761
1772
  pretty: t.Optional[bool] = None,
1762
1773
  realtime: t.Optional[bool] = None,
1763
1774
  refresh: t.Optional[bool] = None,
1764
- routing: t.Optional[str] = None,
1775
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1765
1776
  source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None,
1766
1777
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1767
1778
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
@@ -1891,7 +1902,7 @@ class Elasticsearch(BaseClient):
1891
1902
  pretty: t.Optional[bool] = None,
1892
1903
  realtime: t.Optional[bool] = None,
1893
1904
  refresh: t.Optional[bool] = None,
1894
- routing: t.Optional[str] = None,
1905
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1895
1906
  source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None,
1896
1907
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1897
1908
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
@@ -2002,7 +2013,7 @@ class Elasticsearch(BaseClient):
2002
2013
  pretty: t.Optional[bool] = None,
2003
2014
  q: t.Optional[str] = None,
2004
2015
  query: t.Optional[t.Mapping[str, t.Any]] = None,
2005
- routing: t.Optional[str] = None,
2016
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2006
2017
  source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None,
2007
2018
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2008
2019
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
@@ -2012,8 +2023,8 @@ class Elasticsearch(BaseClient):
2012
2023
  """
2013
2024
  .. raw:: html
2014
2025
 
2015
- <p>Explain a document match result.
2016
- Get information about why a specific document matches, or doesn't match, a query.
2026
+ <p>Explain a document match result.</p>
2027
+ <p>Get information about why a specific document matches, or doesn't match, a query.
2017
2028
  It computes a score explanation for a query and a specific document.</p>
2018
2029
 
2019
2030
 
@@ -2113,7 +2124,7 @@ class Elasticsearch(BaseClient):
2113
2124
  )
2114
2125
 
2115
2126
  @_rewrite_parameters(
2116
- body_fields=("fields", "index_filter", "runtime_mappings"),
2127
+ body_fields=("fields", "index_filter", "project_routing", "runtime_mappings"),
2117
2128
  )
2118
2129
  def field_caps(
2119
2130
  self,
@@ -2131,7 +2142,7 @@ class Elasticsearch(BaseClient):
2131
2142
  ] = None,
2132
2143
  fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2133
2144
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2134
- filters: t.Optional[str] = None,
2145
+ filters: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2135
2146
  human: t.Optional[bool] = None,
2136
2147
  ignore_unavailable: t.Optional[bool] = None,
2137
2148
  include_empty_fields: t.Optional[bool] = None,
@@ -2224,8 +2235,6 @@ class Elasticsearch(BaseClient):
2224
2235
  __query["include_unmapped"] = include_unmapped
2225
2236
  if pretty is not None:
2226
2237
  __query["pretty"] = pretty
2227
- if project_routing is not None:
2228
- __query["project_routing"] = project_routing
2229
2238
  if types is not None:
2230
2239
  __query["types"] = types
2231
2240
  if not __body:
@@ -2233,6 +2242,8 @@ class Elasticsearch(BaseClient):
2233
2242
  __body["fields"] = fields
2234
2243
  if index_filter is not None:
2235
2244
  __body["index_filter"] = index_filter
2245
+ if project_routing is not None:
2246
+ __body["project_routing"] = project_routing
2236
2247
  if runtime_mappings is not None:
2237
2248
  __body["runtime_mappings"] = runtime_mappings
2238
2249
  if not __body:
@@ -2271,7 +2282,7 @@ class Elasticsearch(BaseClient):
2271
2282
  pretty: t.Optional[bool] = None,
2272
2283
  realtime: t.Optional[bool] = None,
2273
2284
  refresh: t.Optional[bool] = None,
2274
- routing: t.Optional[str] = None,
2285
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2275
2286
  source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None,
2276
2287
  source_exclude_vectors: t.Optional[bool] = None,
2277
2288
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
@@ -2429,8 +2440,8 @@ class Elasticsearch(BaseClient):
2429
2440
  """
2430
2441
  .. raw:: html
2431
2442
 
2432
- <p>Get a script or search template.
2433
- Retrieves a stored script or search template.</p>
2443
+ <p>Get a script or search template.</p>
2444
+ <p>Retrieves a stored script or search template.</p>
2434
2445
 
2435
2446
 
2436
2447
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get-script>`_
@@ -2563,7 +2574,7 @@ class Elasticsearch(BaseClient):
2563
2574
  pretty: t.Optional[bool] = None,
2564
2575
  realtime: t.Optional[bool] = None,
2565
2576
  refresh: t.Optional[bool] = None,
2566
- routing: t.Optional[str] = None,
2577
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2567
2578
  source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None,
2568
2579
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2569
2580
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
@@ -2666,8 +2677,8 @@ class Elasticsearch(BaseClient):
2666
2677
  """
2667
2678
  .. raw:: html
2668
2679
 
2669
- <p>Get the cluster health.
2670
- Get a report with the health status of an Elasticsearch cluster.
2680
+ <p>Get the cluster health.</p>
2681
+ <p>Get a report with the health status of an Elasticsearch cluster.
2671
2682
  The report contains a list of indicators that compose Elasticsearch functionality.</p>
2672
2683
  <p>Each indicator has a health status of: green, unknown, yellow or red.
2673
2684
  The indicator will provide an explanation and metadata describing the reason for its current health status.</p>
@@ -2745,7 +2756,7 @@ class Elasticsearch(BaseClient):
2745
2756
  ] = None,
2746
2757
  require_alias: t.Optional[bool] = None,
2747
2758
  require_data_stream: t.Optional[bool] = None,
2748
- routing: t.Optional[str] = None,
2759
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2749
2760
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2750
2761
  version: t.Optional[int] = None,
2751
2762
  version_type: t.Optional[
@@ -2838,13 +2849,11 @@ class Elasticsearch(BaseClient):
2838
2849
  &quot;id&quot;: &quot;elkbee&quot;
2839
2850
  }
2840
2851
  }
2841
-
2842
- In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.
2843
- If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).
2844
-
2845
- A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.
2846
- Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.
2847
2852
  </code></pre>
2853
+ <p>In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.
2854
+ If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).</p>
2855
+ <p>A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.
2856
+ Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.</p>
2848
2857
 
2849
2858
 
2850
2859
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create>`_
@@ -2979,8 +2988,8 @@ class Elasticsearch(BaseClient):
2979
2988
  """
2980
2989
  .. raw:: html
2981
2990
 
2982
- <p>Get cluster info.
2983
- Get basic build, version, and cluster information.
2991
+ <p>Get cluster info.</p>
2992
+ <p>Get basic build, version, and cluster information.
2984
2993
  ::: In Serverless, this API is retained for backward compatibility only. Some response fields, such as the version number, should be ignored.</p>
2985
2994
 
2986
2995
 
@@ -3029,7 +3038,7 @@ class Elasticsearch(BaseClient):
3029
3038
  pretty: t.Optional[bool] = None,
3030
3039
  realtime: t.Optional[bool] = None,
3031
3040
  refresh: t.Optional[bool] = None,
3032
- routing: t.Optional[str] = None,
3041
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3033
3042
  source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None,
3034
3043
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3035
3044
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
@@ -3166,7 +3175,7 @@ class Elasticsearch(BaseClient):
3166
3175
  pretty: t.Optional[bool] = None,
3167
3176
  project_routing: t.Optional[str] = None,
3168
3177
  rest_total_hits_as_int: t.Optional[bool] = None,
3169
- routing: t.Optional[str] = None,
3178
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3170
3179
  search_type: t.Optional[
3171
3180
  t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]]
3172
3181
  ] = None,
@@ -3432,7 +3441,7 @@ class Elasticsearch(BaseClient):
3432
3441
  preference: t.Optional[str] = None,
3433
3442
  pretty: t.Optional[bool] = None,
3434
3443
  realtime: t.Optional[bool] = None,
3435
- routing: t.Optional[str] = None,
3444
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3436
3445
  term_statistics: t.Optional[bool] = None,
3437
3446
  version: t.Optional[int] = None,
3438
3447
  version_type: t.Optional[
@@ -3537,7 +3546,7 @@ class Elasticsearch(BaseClient):
3537
3546
  )
3538
3547
 
3539
3548
  @_rewrite_parameters(
3540
- body_fields=("index_filter",),
3549
+ body_fields=("index_filter", "project_routing"),
3541
3550
  )
3542
3551
  def open_point_in_time(
3543
3552
  self,
@@ -3562,7 +3571,7 @@ class Elasticsearch(BaseClient):
3562
3571
  preference: t.Optional[str] = None,
3563
3572
  pretty: t.Optional[bool] = None,
3564
3573
  project_routing: t.Optional[str] = None,
3565
- routing: t.Optional[str] = None,
3574
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3566
3575
  body: t.Optional[t.Dict[str, t.Any]] = None,
3567
3576
  ) -> ObjectApiResponse[t.Any]:
3568
3577
  """
@@ -3654,13 +3663,13 @@ class Elasticsearch(BaseClient):
3654
3663
  __query["preference"] = preference
3655
3664
  if pretty is not None:
3656
3665
  __query["pretty"] = pretty
3657
- if project_routing is not None:
3658
- __query["project_routing"] = project_routing
3659
3666
  if routing is not None:
3660
3667
  __query["routing"] = routing
3661
3668
  if not __body:
3662
3669
  if index_filter is not None:
3663
3670
  __body["index_filter"] = index_filter
3671
+ if project_routing is not None:
3672
+ __body["project_routing"] = project_routing
3664
3673
  if not __body:
3665
3674
  __body = None # type: ignore[assignment]
3666
3675
  __headers = {"accept": "application/json"}
@@ -3696,8 +3705,8 @@ class Elasticsearch(BaseClient):
3696
3705
  """
3697
3706
  .. raw:: html
3698
3707
 
3699
- <p>Create or update a script or search template.
3700
- Creates or updates a stored script or search template.</p>
3708
+ <p>Create or update a script or search template.</p>
3709
+ <p>Creates or updates a stored script or search template.</p>
3701
3710
 
3702
3711
 
3703
3712
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-put-script>`_
@@ -3780,7 +3789,9 @@ class Elasticsearch(BaseClient):
3780
3789
  ignore_unavailable: t.Optional[bool] = None,
3781
3790
  metric: t.Optional[t.Mapping[str, t.Any]] = None,
3782
3791
  pretty: t.Optional[bool] = None,
3783
- search_type: t.Optional[str] = None,
3792
+ search_type: t.Optional[
3793
+ t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]]
3794
+ ] = None,
3784
3795
  body: t.Optional[t.Dict[str, t.Any]] = None,
3785
3796
  ) -> ObjectApiResponse[t.Any]:
3786
3797
  """
@@ -3900,7 +3911,8 @@ class Elasticsearch(BaseClient):
3900
3911
  <li>To automatically create a data stream or index with a reindex API request, you must have the <code>auto_configure</code>, <code>create_index</code>, or <code>manage</code> index privilege for the destination data stream, index, or alias.</li>
3901
3912
  <li>If reindexing from a remote cluster, the <code>source.remote.user</code> must have the <code>monitor</code> cluster privilege and the <code>read</code> index privilege for the source data stream, index, or alias.</li>
3902
3913
  </ul>
3903
- <p>If reindexing from a remote cluster, you must explicitly allow the remote host in the <code>reindex.remote.whitelist</code> setting.
3914
+ <p>If reindexing from a remote cluster into a cluster using Elastic Stack, you must explicitly allow the remote host using the <code>reindex.remote.whitelist</code> node setting on the destination cluster.
3915
+ If reindexing from a remote cluster into an Elastic Cloud Serverless project, only remote hosts from Elastic Cloud Hosted are allowed.
3904
3916
  Automatic data stream creation requires a matching index template with data stream enabled.</p>
3905
3917
  <p>The <code>dest</code> element can be configured like the index API to control optimistic concurrency control.
3906
3918
  Omitting <code>version_type</code> or setting it to <code>internal</code> causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID.</p>
@@ -4027,11 +4039,11 @@ class Elasticsearch(BaseClient):
4027
4039
  self,
4028
4040
  *,
4029
4041
  task_id: str,
4042
+ requests_per_second: float,
4030
4043
  error_trace: t.Optional[bool] = None,
4031
4044
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4032
4045
  human: t.Optional[bool] = None,
4033
4046
  pretty: t.Optional[bool] = None,
4034
- requests_per_second: t.Optional[float] = None,
4035
4047
  ) -> ObjectApiResponse[t.Any]:
4036
4048
  """
4037
4049
  .. raw:: html
@@ -4055,9 +4067,13 @@ class Elasticsearch(BaseClient):
4055
4067
  """
4056
4068
  if task_id in SKIP_IN_PATH:
4057
4069
  raise ValueError("Empty value passed for parameter 'task_id'")
4070
+ if requests_per_second is None:
4071
+ raise ValueError("Empty value passed for parameter 'requests_per_second'")
4058
4072
  __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)}
4059
4073
  __path = f'/_reindex/{__path_parts["task_id"]}/_rethrottle'
4060
4074
  __query: t.Dict[str, t.Any] = {}
4075
+ if requests_per_second is not None:
4076
+ __query["requests_per_second"] = requests_per_second
4061
4077
  if error_trace is not None:
4062
4078
  __query["error_trace"] = error_trace
4063
4079
  if filter_path is not None:
@@ -4066,8 +4082,6 @@ class Elasticsearch(BaseClient):
4066
4082
  __query["human"] = human
4067
4083
  if pretty is not None:
4068
4084
  __query["pretty"] = pretty
4069
- if requests_per_second is not None:
4070
- __query["requests_per_second"] = requests_per_second
4071
4085
  __headers = {"accept": "application/json"}
4072
4086
  return self.perform_request( # type: ignore[return-value]
4073
4087
  "POST",
@@ -4151,7 +4165,7 @@ class Elasticsearch(BaseClient):
4151
4165
  @_rewrite_parameters(
4152
4166
  body_fields=("context", "context_setup", "script"),
4153
4167
  )
4154
- @_stability_warning(Stability.EXPERIMENTAL)
4168
+ @_availability_warning(Stability.EXPERIMENTAL)
4155
4169
  def scripts_painless_execute(
4156
4170
  self,
4157
4171
  *,
@@ -4322,6 +4336,7 @@ class Elasticsearch(BaseClient):
4322
4336
  "pit",
4323
4337
  "post_filter",
4324
4338
  "profile",
4339
+ "project_routing",
4325
4340
  "query",
4326
4341
  "rank",
4327
4342
  "rescore",
@@ -4410,7 +4425,7 @@ class Elasticsearch(BaseClient):
4410
4425
  ] = None,
4411
4426
  rest_total_hits_as_int: t.Optional[bool] = None,
4412
4427
  retriever: t.Optional[t.Mapping[str, t.Any]] = None,
4413
- routing: t.Optional[str] = None,
4428
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4414
4429
  runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
4415
4430
  script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
4416
4431
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -4742,8 +4757,6 @@ class Elasticsearch(BaseClient):
4742
4757
  __query["preference"] = preference
4743
4758
  if pretty is not None:
4744
4759
  __query["pretty"] = pretty
4745
- if project_routing is not None:
4746
- __query["project_routing"] = project_routing
4747
4760
  if q is not None:
4748
4761
  __query["q"] = q
4749
4762
  if request_cache is not None:
@@ -4803,6 +4816,8 @@ class Elasticsearch(BaseClient):
4803
4816
  __body["post_filter"] = post_filter
4804
4817
  if profile is not None:
4805
4818
  __body["profile"] = profile
4819
+ if project_routing is not None:
4820
+ __body["project_routing"] = project_routing
4806
4821
  if query is not None:
4807
4822
  __body["query"] = query
4808
4823
  if rank is not None:
@@ -5185,11 +5200,19 @@ class Elasticsearch(BaseClient):
5185
5200
 
5186
5201
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search-mvt>`_
5187
5202
 
5188
- :param index: Comma-separated list of data streams, indices, or aliases to search
5189
- :param field: Field containing geospatial data to return
5190
- :param zoom: Zoom level for the vector tile to search
5191
- :param x: X coordinate for the vector tile to search
5192
- :param y: Y coordinate for the vector tile to search
5203
+ :param index: A list of indices, data streams, or aliases to search. It supports
5204
+ wildcards (`*`). To search all data streams and indices, omit this parameter
5205
+ or use `*` or `_all`. To search a remote cluster, use the `<cluster>:<target>`
5206
+ syntax.
5207
+ :param field: A field that contains the geospatial data to return. It must be
5208
+ a `geo_point` or `geo_shape` field. The field must have doc values enabled.
5209
+ It cannot be a nested field. NOTE: Vector tiles do not natively support geometry
5210
+ collections. For `geometrycollection` values in a `geo_shape` field, the
5211
+ API returns a hits layer feature for each element of the collection. This
5212
+ behavior may change in a future release.
5213
+ :param zoom: The zoom level of the vector tile to search. It accepts `0` to `29`.
5214
+ :param x: The X coordinate for the vector tile to search.
5215
+ :param y: The Y coordinate for the vector tile to search.
5193
5216
  :param aggs: Sub-aggregations for the geotile_grid. It supports the following
5194
5217
  aggregation types: - `avg` - `boxplot` - `cardinality` - `extended stats`
5195
5218
  - `max` - `median absolute deviation` - `min` - `percentile` - `percentile-rank`
@@ -5351,7 +5374,7 @@ class Elasticsearch(BaseClient):
5351
5374
  master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
5352
5375
  preference: t.Optional[str] = None,
5353
5376
  pretty: t.Optional[bool] = None,
5354
- routing: t.Optional[str] = None,
5377
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
5355
5378
  ) -> ObjectApiResponse[t.Any]:
5356
5379
  """
5357
5380
  .. raw:: html
@@ -5460,7 +5483,7 @@ class Elasticsearch(BaseClient):
5460
5483
  profile: t.Optional[bool] = None,
5461
5484
  project_routing: t.Optional[str] = None,
5462
5485
  rest_total_hits_as_int: t.Optional[bool] = None,
5463
- routing: t.Optional[str] = None,
5486
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
5464
5487
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
5465
5488
  search_type: t.Optional[
5466
5489
  t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]]
@@ -5597,7 +5620,7 @@ class Elasticsearch(BaseClient):
5597
5620
  def terms_enum(
5598
5621
  self,
5599
5622
  *,
5600
- index: str,
5623
+ index: t.Union[str, t.Sequence[str]],
5601
5624
  field: t.Optional[str] = None,
5602
5625
  case_insensitive: t.Optional[bool] = None,
5603
5626
  error_trace: t.Optional[bool] = None,
@@ -5723,7 +5746,7 @@ class Elasticsearch(BaseClient):
5723
5746
  preference: t.Optional[str] = None,
5724
5747
  pretty: t.Optional[bool] = None,
5725
5748
  realtime: t.Optional[bool] = None,
5726
- routing: t.Optional[str] = None,
5749
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
5727
5750
  term_statistics: t.Optional[bool] = None,
5728
5751
  version: t.Optional[int] = None,
5729
5752
  version_type: t.Optional[
@@ -5907,7 +5930,7 @@ class Elasticsearch(BaseClient):
5907
5930
  ] = None,
5908
5931
  require_alias: t.Optional[bool] = None,
5909
5932
  retry_on_conflict: t.Optional[int] = None,
5910
- routing: t.Optional[str] = None,
5933
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
5911
5934
  script: t.Optional[t.Mapping[str, t.Any]] = None,
5912
5935
  scripted_upsert: t.Optional[bool] = None,
5913
5936
  source: t.Optional[t.Union[bool, t.Mapping[str, t.Any]]] = None,
@@ -6087,7 +6110,7 @@ class Elasticsearch(BaseClient):
6087
6110
  refresh: t.Optional[bool] = None,
6088
6111
  request_cache: t.Optional[bool] = None,
6089
6112
  requests_per_second: t.Optional[float] = None,
6090
- routing: t.Optional[str] = None,
6113
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
6091
6114
  script: t.Optional[t.Mapping[str, t.Any]] = None,
6092
6115
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
6093
6116
  scroll_size: t.Optional[int] = None,
@@ -6112,8 +6135,8 @@ class Elasticsearch(BaseClient):
6112
6135
  """
6113
6136
  .. raw:: html
6114
6137
 
6115
- <p>Update documents.
6116
- Updates documents that match the specified query.
6138
+ <p>Update documents.</p>
6139
+ <p>Updates documents that match the specified query.
6117
6140
  If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes.</p>
6118
6141
  <p>If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias:</p>
6119
6142
  <ul>
@@ -6392,11 +6415,11 @@ class Elasticsearch(BaseClient):
6392
6415
  self,
6393
6416
  *,
6394
6417
  task_id: str,
6418
+ requests_per_second: float,
6395
6419
  error_trace: t.Optional[bool] = None,
6396
6420
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
6397
6421
  human: t.Optional[bool] = None,
6398
6422
  pretty: t.Optional[bool] = None,
6399
- requests_per_second: t.Optional[float] = None,
6400
6423
  ) -> ObjectApiResponse[t.Any]:
6401
6424
  """
6402
6425
  .. raw:: html
@@ -6414,9 +6437,13 @@ class Elasticsearch(BaseClient):
6414
6437
  """
6415
6438
  if task_id in SKIP_IN_PATH:
6416
6439
  raise ValueError("Empty value passed for parameter 'task_id'")
6440
+ if requests_per_second is None:
6441
+ raise ValueError("Empty value passed for parameter 'requests_per_second'")
6417
6442
  __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)}
6418
6443
  __path = f'/_update_by_query/{__path_parts["task_id"]}/_rethrottle'
6419
6444
  __query: t.Dict[str, t.Any] = {}
6445
+ if requests_per_second is not None:
6446
+ __query["requests_per_second"] = requests_per_second
6420
6447
  if error_trace is not None:
6421
6448
  __query["error_trace"] = error_trace
6422
6449
  if filter_path is not None:
@@ -6425,8 +6452,6 @@ class Elasticsearch(BaseClient):
6425
6452
  __query["human"] = human
6426
6453
  if pretty is not None:
6427
6454
  __query["pretty"] = pretty
6428
- if requests_per_second is not None:
6429
- __query["requests_per_second"] = requests_per_second
6430
6455
  __headers = {"accept": "application/json"}
6431
6456
  return self.perform_request( # type: ignore[return-value]
6432
6457
  "POST",