elasticsearch 8.17.2__py3-none-any.whl → 9.0.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 (138) hide show
  1. elasticsearch/_async/client/__init__.py +192 -312
  2. elasticsearch/_async/client/_base.py +1 -2
  3. elasticsearch/_async/client/async_search.py +14 -14
  4. elasticsearch/_async/client/autoscaling.py +4 -4
  5. elasticsearch/_async/client/cat.py +26 -33
  6. elasticsearch/_async/client/ccr.py +186 -72
  7. elasticsearch/_async/client/cluster.py +42 -23
  8. elasticsearch/_async/client/connector.py +44 -30
  9. elasticsearch/_async/client/dangling_indices.py +3 -3
  10. elasticsearch/_async/client/enrich.py +26 -5
  11. elasticsearch/_async/client/eql.py +32 -4
  12. elasticsearch/_async/client/esql.py +64 -12
  13. elasticsearch/_async/client/features.py +12 -2
  14. elasticsearch/_async/client/fleet.py +23 -19
  15. elasticsearch/_async/client/graph.py +1 -1
  16. elasticsearch/_async/client/ilm.py +30 -22
  17. elasticsearch/_async/client/indices.py +435 -231
  18. elasticsearch/_async/client/inference.py +1906 -61
  19. elasticsearch/_async/client/ingest.py +32 -38
  20. elasticsearch/_async/client/license.py +51 -16
  21. elasticsearch/_async/client/logstash.py +3 -3
  22. elasticsearch/_async/client/migration.py +3 -3
  23. elasticsearch/_async/client/ml.py +145 -121
  24. elasticsearch/_async/client/monitoring.py +1 -1
  25. elasticsearch/_async/client/nodes.py +10 -28
  26. elasticsearch/_async/client/query_rules.py +8 -8
  27. elasticsearch/_async/client/rollup.py +8 -8
  28. elasticsearch/_async/client/search_application.py +13 -13
  29. elasticsearch/_async/client/searchable_snapshots.py +4 -4
  30. elasticsearch/_async/client/security.py +78 -75
  31. elasticsearch/_async/client/shutdown.py +3 -10
  32. elasticsearch/_async/client/simulate.py +6 -6
  33. elasticsearch/_async/client/slm.py +9 -9
  34. elasticsearch/_async/client/snapshot.py +280 -134
  35. elasticsearch/_async/client/sql.py +6 -6
  36. elasticsearch/_async/client/ssl.py +1 -1
  37. elasticsearch/_async/client/synonyms.py +7 -7
  38. elasticsearch/_async/client/tasks.py +3 -9
  39. elasticsearch/_async/client/text_structure.py +4 -4
  40. elasticsearch/_async/client/transform.py +30 -28
  41. elasticsearch/_async/client/watcher.py +23 -15
  42. elasticsearch/_async/client/xpack.py +2 -2
  43. elasticsearch/_async/helpers.py +0 -1
  44. elasticsearch/_sync/client/__init__.py +192 -312
  45. elasticsearch/_sync/client/_base.py +1 -2
  46. elasticsearch/_sync/client/async_search.py +14 -14
  47. elasticsearch/_sync/client/autoscaling.py +4 -4
  48. elasticsearch/_sync/client/cat.py +26 -33
  49. elasticsearch/_sync/client/ccr.py +186 -72
  50. elasticsearch/_sync/client/cluster.py +42 -23
  51. elasticsearch/_sync/client/connector.py +44 -30
  52. elasticsearch/_sync/client/dangling_indices.py +3 -3
  53. elasticsearch/_sync/client/enrich.py +26 -5
  54. elasticsearch/_sync/client/eql.py +32 -4
  55. elasticsearch/_sync/client/esql.py +64 -12
  56. elasticsearch/_sync/client/features.py +12 -2
  57. elasticsearch/_sync/client/fleet.py +23 -19
  58. elasticsearch/_sync/client/graph.py +1 -1
  59. elasticsearch/_sync/client/ilm.py +30 -22
  60. elasticsearch/_sync/client/indices.py +435 -231
  61. elasticsearch/_sync/client/inference.py +1906 -61
  62. elasticsearch/_sync/client/ingest.py +32 -38
  63. elasticsearch/_sync/client/license.py +51 -16
  64. elasticsearch/_sync/client/logstash.py +3 -3
  65. elasticsearch/_sync/client/migration.py +3 -3
  66. elasticsearch/_sync/client/ml.py +145 -121
  67. elasticsearch/_sync/client/monitoring.py +1 -1
  68. elasticsearch/_sync/client/nodes.py +10 -28
  69. elasticsearch/_sync/client/query_rules.py +8 -8
  70. elasticsearch/_sync/client/rollup.py +8 -8
  71. elasticsearch/_sync/client/search_application.py +13 -13
  72. elasticsearch/_sync/client/searchable_snapshots.py +4 -4
  73. elasticsearch/_sync/client/security.py +78 -75
  74. elasticsearch/_sync/client/shutdown.py +3 -10
  75. elasticsearch/_sync/client/simulate.py +6 -6
  76. elasticsearch/_sync/client/slm.py +9 -9
  77. elasticsearch/_sync/client/snapshot.py +280 -134
  78. elasticsearch/_sync/client/sql.py +6 -6
  79. elasticsearch/_sync/client/ssl.py +1 -1
  80. elasticsearch/_sync/client/synonyms.py +7 -7
  81. elasticsearch/_sync/client/tasks.py +3 -9
  82. elasticsearch/_sync/client/text_structure.py +4 -4
  83. elasticsearch/_sync/client/transform.py +30 -28
  84. elasticsearch/_sync/client/utils.py +0 -40
  85. elasticsearch/_sync/client/watcher.py +23 -15
  86. elasticsearch/_sync/client/xpack.py +2 -2
  87. elasticsearch/_version.py +1 -1
  88. elasticsearch/dsl/__init__.py +203 -0
  89. elasticsearch/dsl/_async/__init__.py +16 -0
  90. elasticsearch/dsl/_async/document.py +522 -0
  91. elasticsearch/dsl/_async/faceted_search.py +50 -0
  92. elasticsearch/dsl/_async/index.py +639 -0
  93. elasticsearch/dsl/_async/mapping.py +49 -0
  94. elasticsearch/dsl/_async/search.py +237 -0
  95. elasticsearch/dsl/_async/update_by_query.py +47 -0
  96. elasticsearch/dsl/_sync/__init__.py +16 -0
  97. elasticsearch/dsl/_sync/document.py +514 -0
  98. elasticsearch/dsl/_sync/faceted_search.py +50 -0
  99. elasticsearch/dsl/_sync/index.py +597 -0
  100. elasticsearch/dsl/_sync/mapping.py +49 -0
  101. elasticsearch/dsl/_sync/search.py +230 -0
  102. elasticsearch/dsl/_sync/update_by_query.py +45 -0
  103. elasticsearch/dsl/aggs.py +3734 -0
  104. elasticsearch/dsl/analysis.py +341 -0
  105. elasticsearch/dsl/async_connections.py +37 -0
  106. elasticsearch/dsl/connections.py +142 -0
  107. elasticsearch/dsl/document.py +20 -0
  108. elasticsearch/dsl/document_base.py +444 -0
  109. elasticsearch/dsl/exceptions.py +32 -0
  110. elasticsearch/dsl/faceted_search.py +28 -0
  111. elasticsearch/dsl/faceted_search_base.py +489 -0
  112. elasticsearch/dsl/field.py +4392 -0
  113. elasticsearch/dsl/function.py +180 -0
  114. elasticsearch/dsl/index.py +23 -0
  115. elasticsearch/dsl/index_base.py +178 -0
  116. elasticsearch/dsl/mapping.py +19 -0
  117. elasticsearch/dsl/mapping_base.py +219 -0
  118. elasticsearch/dsl/query.py +2822 -0
  119. elasticsearch/dsl/response/__init__.py +388 -0
  120. elasticsearch/dsl/response/aggs.py +100 -0
  121. elasticsearch/dsl/response/hit.py +53 -0
  122. elasticsearch/dsl/search.py +20 -0
  123. elasticsearch/dsl/search_base.py +1053 -0
  124. elasticsearch/dsl/serializer.py +34 -0
  125. elasticsearch/dsl/types.py +6453 -0
  126. elasticsearch/dsl/update_by_query.py +19 -0
  127. elasticsearch/dsl/update_by_query_base.py +149 -0
  128. elasticsearch/dsl/utils.py +687 -0
  129. elasticsearch/dsl/wrappers.py +144 -0
  130. elasticsearch/helpers/vectorstore/_async/strategies.py +12 -12
  131. elasticsearch/helpers/vectorstore/_sync/strategies.py +12 -12
  132. {elasticsearch-8.17.2.dist-info → elasticsearch-9.0.0.dist-info}/METADATA +12 -15
  133. elasticsearch-9.0.0.dist-info/RECORD +160 -0
  134. elasticsearch/transport.py +0 -57
  135. elasticsearch-8.17.2.dist-info/RECORD +0 -119
  136. {elasticsearch-8.17.2.dist-info → elasticsearch-9.0.0.dist-info}/WHEEL +0 -0
  137. {elasticsearch-8.17.2.dist-info → elasticsearch-9.0.0.dist-info}/licenses/LICENSE +0 -0
  138. {elasticsearch-8.17.2.dist-info → elasticsearch-9.0.0.dist-info}/licenses/NOTICE +0 -0
@@ -18,7 +18,6 @@
18
18
 
19
19
  import logging
20
20
  import typing as t
21
- import warnings
22
21
 
23
22
  from elastic_transport import (
24
23
  BaseNode,
@@ -181,37 +180,13 @@ class Elasticsearch(BaseClient):
181
180
  t.Callable[[t.Dict[str, t.Any], NodeConfig], t.Optional[NodeConfig]]
182
181
  ] = None,
183
182
  meta_header: t.Union[DefaultType, bool] = DEFAULT,
184
- timeout: t.Union[DefaultType, None, float] = DEFAULT,
185
- randomize_hosts: t.Union[DefaultType, bool] = DEFAULT,
186
- host_info_callback: t.Optional[
187
- t.Callable[
188
- [t.Dict[str, t.Any], t.Dict[str, t.Union[str, int]]],
189
- t.Optional[t.Dict[str, t.Union[str, int]]],
190
- ]
191
- ] = None,
192
- sniffer_timeout: t.Union[DefaultType, None, float] = DEFAULT,
193
- sniff_on_connection_fail: t.Union[DefaultType, bool] = DEFAULT,
194
183
  http_auth: t.Union[DefaultType, t.Any] = DEFAULT,
195
- maxsize: t.Union[DefaultType, int] = DEFAULT,
196
184
  # Internal use only
197
185
  _transport: t.Optional[Transport] = None,
198
186
  ) -> None:
199
187
  if hosts is None and cloud_id is None and _transport is None:
200
188
  raise ValueError("Either 'hosts' or 'cloud_id' must be specified")
201
189
 
202
- if timeout is not DEFAULT:
203
- if request_timeout is not DEFAULT:
204
- raise ValueError(
205
- "Can't specify both 'timeout' and 'request_timeout', "
206
- "instead only specify 'request_timeout'"
207
- )
208
- warnings.warn(
209
- "The 'timeout' parameter is deprecated in favor of 'request_timeout'",
210
- category=DeprecationWarning,
211
- stacklevel=2,
212
- )
213
- request_timeout = timeout
214
-
215
190
  if serializer is not None:
216
191
  if serializers is not DEFAULT:
217
192
  raise ValueError(
@@ -220,58 +195,6 @@ class Elasticsearch(BaseClient):
220
195
  )
221
196
  serializers = {default_mimetype: serializer}
222
197
 
223
- if randomize_hosts is not DEFAULT:
224
- if randomize_nodes_in_pool is not DEFAULT:
225
- raise ValueError(
226
- "Can't specify both 'randomize_hosts' and 'randomize_nodes_in_pool', "
227
- "instead only specify 'randomize_nodes_in_pool'"
228
- )
229
- warnings.warn(
230
- "The 'randomize_hosts' parameter is deprecated in favor of 'randomize_nodes_in_pool'",
231
- category=DeprecationWarning,
232
- stacklevel=2,
233
- )
234
- randomize_nodes_in_pool = randomize_hosts
235
-
236
- if sniffer_timeout is not DEFAULT:
237
- if min_delay_between_sniffing is not DEFAULT:
238
- raise ValueError(
239
- "Can't specify both 'sniffer_timeout' and 'min_delay_between_sniffing', "
240
- "instead only specify 'min_delay_between_sniffing'"
241
- )
242
- warnings.warn(
243
- "The 'sniffer_timeout' parameter is deprecated in favor of 'min_delay_between_sniffing'",
244
- category=DeprecationWarning,
245
- stacklevel=2,
246
- )
247
- min_delay_between_sniffing = sniffer_timeout
248
-
249
- if sniff_on_connection_fail is not DEFAULT:
250
- if sniff_on_node_failure is not DEFAULT:
251
- raise ValueError(
252
- "Can't specify both 'sniff_on_connection_fail' and 'sniff_on_node_failure', "
253
- "instead only specify 'sniff_on_node_failure'"
254
- )
255
- warnings.warn(
256
- "The 'sniff_on_connection_fail' parameter is deprecated in favor of 'sniff_on_node_failure'",
257
- category=DeprecationWarning,
258
- stacklevel=2,
259
- )
260
- sniff_on_node_failure = sniff_on_connection_fail
261
-
262
- if maxsize is not DEFAULT:
263
- if connections_per_node is not DEFAULT:
264
- raise ValueError(
265
- "Can't specify both 'maxsize' and 'connections_per_node', "
266
- "instead only specify 'connections_per_node'"
267
- )
268
- warnings.warn(
269
- "The 'maxsize' parameter is deprecated in favor of 'connections_per_node'",
270
- category=DeprecationWarning,
271
- stacklevel=2,
272
- )
273
- connections_per_node = maxsize
274
-
275
198
  # Setting min_delay_between_sniffing=True implies sniff_before_requests=True
276
199
  if min_delay_between_sniffing is not DEFAULT:
277
200
  sniff_before_requests = True
@@ -293,22 +216,7 @@ class Elasticsearch(BaseClient):
293
216
  )
294
217
 
295
218
  sniff_callback = None
296
- if host_info_callback is not None:
297
- if sniffed_node_callback is not None:
298
- raise ValueError(
299
- "Can't specify both 'host_info_callback' and 'sniffed_node_callback', "
300
- "instead only specify 'sniffed_node_callback'"
301
- )
302
- warnings.warn(
303
- "The 'host_info_callback' parameter is deprecated in favor of 'sniffed_node_callback'",
304
- category=DeprecationWarning,
305
- stacklevel=2,
306
- )
307
-
308
- sniff_callback = create_sniff_callback(
309
- host_info_callback=host_info_callback
310
- )
311
- elif sniffed_node_callback is not None:
219
+ if sniffed_node_callback is not None:
312
220
  sniff_callback = create_sniff_callback(
313
221
  sniffed_node_callback=sniffed_node_callback
314
222
  )
@@ -626,6 +534,7 @@ class Elasticsearch(BaseClient):
626
534
  error_trace: t.Optional[bool] = None,
627
535
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
628
536
  human: t.Optional[bool] = None,
537
+ include_source_on_error: t.Optional[bool] = None,
629
538
  list_executed_pipelines: t.Optional[bool] = None,
630
539
  pipeline: t.Optional[str] = None,
631
540
  pretty: t.Optional[bool] = None,
@@ -728,11 +637,13 @@ class Elasticsearch(BaseClient):
728
637
  The other two shards that make up the index do not participate in the <code>_bulk</code> request at all.</p>
729
638
 
730
639
 
731
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-bulk.html>`_
640
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-bulk>`_
732
641
 
733
642
  :param operations:
734
643
  :param index: The name of the data stream, index, or index alias to perform bulk
735
644
  actions on.
645
+ :param include_source_on_error: True or false if to include the document source
646
+ in the error message in case of parsing errors.
736
647
  :param list_executed_pipelines: If `true`, the response will include the ingest
737
648
  pipelines that were run for each index or create.
738
649
  :param pipeline: The pipeline identifier to use to preprocess incoming documents.
@@ -790,6 +701,8 @@ class Elasticsearch(BaseClient):
790
701
  __query["filter_path"] = filter_path
791
702
  if human is not None:
792
703
  __query["human"] = human
704
+ if include_source_on_error is not None:
705
+ __query["include_source_on_error"] = include_source_on_error
793
706
  if list_executed_pipelines is not None:
794
707
  __query["list_executed_pipelines"] = list_executed_pipelines
795
708
  if pipeline is not None:
@@ -849,7 +762,7 @@ class Elasticsearch(BaseClient):
849
762
  Clear the search context and results for a scrolling search.</p>
850
763
 
851
764
 
852
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/clear-scroll-api.html>`_
765
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-clear-scroll>`_
853
766
 
854
767
  :param scroll_id: The scroll IDs to clear. To clear all scroll IDs, use `_all`.
855
768
  """
@@ -906,7 +819,7 @@ class Elasticsearch(BaseClient):
906
819
  However, keeping points in time has a cost; close them as soon as they are no longer required for search requests.</p>
907
820
 
908
821
 
909
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/point-in-time-api.html>`_
822
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-open-point-in-time>`_
910
823
 
911
824
  :param id: The ID of the point-in-time.
912
825
  """
@@ -990,7 +903,7 @@ class Elasticsearch(BaseClient):
990
903
  This means that replicas increase the scalability of the count.</p>
991
904
 
992
905
 
993
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-count.html>`_
906
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-count>`_
994
907
 
995
908
  :param index: A comma-separated list of data streams, indices, and aliases to
996
909
  search. It supports wildcards (`*`). To search all data streams and indices,
@@ -1114,11 +1027,17 @@ class Elasticsearch(BaseClient):
1114
1027
  error_trace: t.Optional[bool] = None,
1115
1028
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1116
1029
  human: t.Optional[bool] = None,
1030
+ if_primary_term: t.Optional[int] = None,
1031
+ if_seq_no: t.Optional[int] = None,
1032
+ include_source_on_error: t.Optional[bool] = None,
1033
+ op_type: t.Optional[t.Union[str, t.Literal["create", "index"]]] = None,
1117
1034
  pipeline: t.Optional[str] = None,
1118
1035
  pretty: t.Optional[bool] = None,
1119
1036
  refresh: t.Optional[
1120
1037
  t.Union[bool, str, t.Literal["false", "true", "wait_for"]]
1121
1038
  ] = None,
1039
+ require_alias: t.Optional[bool] = None,
1040
+ require_data_stream: t.Optional[bool] = None,
1122
1041
  routing: t.Optional[str] = None,
1123
1042
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1124
1043
  version: t.Optional[int] = None,
@@ -1163,7 +1082,7 @@ class Elasticsearch(BaseClient):
1163
1082
  This does come at the (very minimal) cost of an additional document parsing pass.
1164
1083
  If the <code>_routing</code> mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.</p>
1165
1084
  <p>NOTE: Data streams do not support custom routing unless they were created with the <code>allow_custom_routing</code> setting enabled in the template.</p>
1166
- <p>** Distributed**</p>
1085
+ <p><strong>Distributed</strong></p>
1167
1086
  <p>The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard.
1168
1087
  After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.</p>
1169
1088
  <p><strong>Active shards</strong></p>
@@ -1186,7 +1105,7 @@ class Elasticsearch(BaseClient):
1186
1105
  The <code>_shards</code> section of the API response reveals the number of shard copies on which replication succeeded and failed.</p>
1187
1106
 
1188
1107
 
1189
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-index_.html>`_
1108
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-create>`_
1190
1109
 
1191
1110
  :param index: The name of the data stream or index to target. If the target doesn't
1192
1111
  exist and matches the name or wildcard (`*`) pattern of an index template
@@ -1196,6 +1115,18 @@ class Elasticsearch(BaseClient):
1196
1115
  :param id: A unique identifier for the document. To automatically generate a
1197
1116
  document ID, use the `POST /<target>/_doc/` request format.
1198
1117
  :param document:
1118
+ :param if_primary_term: Only perform the operation if the document has this primary
1119
+ term.
1120
+ :param if_seq_no: Only perform the operation if the document has this sequence
1121
+ number.
1122
+ :param include_source_on_error: True or false if to include the document source
1123
+ in the error message in case of parsing errors.
1124
+ :param op_type: Set to `create` to only index the document if it does not already
1125
+ exist (put if absent). If a document with the specified `_id` already exists,
1126
+ the indexing operation will fail. The behavior is the same as using the `<index>/_create`
1127
+ endpoint. If a document ID is specified, this paramater defaults to `index`.
1128
+ Otherwise, it defaults to `create`. If the request targets a data stream,
1129
+ an `op_type` of `create` is required.
1199
1130
  :param pipeline: The ID of the pipeline to use to preprocess incoming documents.
1200
1131
  If the index has a default ingest pipeline specified, setting the value to
1201
1132
  `_none` turns off the default ingest pipeline for this request. If a final
@@ -1204,6 +1135,9 @@ class Elasticsearch(BaseClient):
1204
1135
  :param refresh: If `true`, Elasticsearch refreshes the affected shards to make
1205
1136
  this operation visible to search. If `wait_for`, it waits for a refresh to
1206
1137
  make this operation visible to search. If `false`, it does nothing with refreshes.
1138
+ :param require_alias: If `true`, the destination must be an index alias.
1139
+ :param require_data_stream: If `true`, the request's actions must target a data
1140
+ stream (existing or to be created).
1207
1141
  :param routing: A custom value that is used to route operations to a specific
1208
1142
  shard.
1209
1143
  :param timeout: The period the request waits for the following operations: automatic
@@ -1244,12 +1178,24 @@ class Elasticsearch(BaseClient):
1244
1178
  __query["filter_path"] = filter_path
1245
1179
  if human is not None:
1246
1180
  __query["human"] = human
1181
+ if if_primary_term is not None:
1182
+ __query["if_primary_term"] = if_primary_term
1183
+ if if_seq_no is not None:
1184
+ __query["if_seq_no"] = if_seq_no
1185
+ if include_source_on_error is not None:
1186
+ __query["include_source_on_error"] = include_source_on_error
1187
+ if op_type is not None:
1188
+ __query["op_type"] = op_type
1247
1189
  if pipeline is not None:
1248
1190
  __query["pipeline"] = pipeline
1249
1191
  if pretty is not None:
1250
1192
  __query["pretty"] = pretty
1251
1193
  if refresh is not None:
1252
1194
  __query["refresh"] = refresh
1195
+ if require_alias is not None:
1196
+ __query["require_alias"] = require_alias
1197
+ if require_data_stream is not None:
1198
+ __query["require_data_stream"] = require_data_stream
1253
1199
  if routing is not None:
1254
1200
  __query["routing"] = routing
1255
1201
  if timeout is not None:
@@ -1326,7 +1272,7 @@ class Elasticsearch(BaseClient):
1326
1272
  It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.</p>
1327
1273
 
1328
1274
 
1329
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-delete.html>`_
1275
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-delete>`_
1330
1276
 
1331
1277
  :param index: The name of the target index.
1332
1278
  :param id: A unique identifier for the document.
@@ -1515,7 +1461,7 @@ class Elasticsearch(BaseClient):
1515
1461
  The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself.</p>
1516
1462
 
1517
1463
 
1518
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-delete-by-query.html>`_
1464
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-delete-by-query>`_
1519
1465
 
1520
1466
  :param index: A comma-separated list of data streams, indices, and aliases to
1521
1467
  search. It supports wildcards (`*`). To search all data streams or indices,
@@ -1541,7 +1487,7 @@ class Elasticsearch(BaseClient):
1541
1487
  If the request can target data streams, this argument determines whether
1542
1488
  wildcard expressions match hidden data streams. It supports comma-separated
1543
1489
  values, such as `open,hidden`.
1544
- :param from_: Starting offset (default: 0)
1490
+ :param from_: Skips the specified number of documents.
1545
1491
  :param ignore_unavailable: If `false`, the request returns an error if it targets
1546
1492
  a missing or closed index.
1547
1493
  :param lenient: If `true`, format-based query failures (such as providing text
@@ -1712,7 +1658,7 @@ class Elasticsearch(BaseClient):
1712
1658
  Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.</p>
1713
1659
 
1714
1660
 
1715
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-delete-by-query.html#docs-delete-by-query-rethrottle>`_
1661
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-delete-by-query-rethrottle>`_
1716
1662
 
1717
1663
  :param task_id: The ID for the task.
1718
1664
  :param requests_per_second: The throttle for this request in sub-requests per
@@ -1762,7 +1708,7 @@ class Elasticsearch(BaseClient):
1762
1708
  Deletes a stored script or search template.</p>
1763
1709
 
1764
1710
 
1765
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/delete-stored-script-api.html>`_
1711
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-delete-script>`_
1766
1712
 
1767
1713
  :param id: The identifier for the stored script or search template.
1768
1714
  :param master_timeout: The period to wait for a connection to the master node.
@@ -1846,7 +1792,7 @@ class Elasticsearch(BaseClient):
1846
1792
  Elasticsearch cleans up deleted documents in the background as you continue to index more data.</p>
1847
1793
 
1848
1794
 
1849
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-get.html>`_
1795
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-get>`_
1850
1796
 
1851
1797
  :param index: A comma-separated list of data streams, indices, and aliases. It
1852
1798
  supports wildcards (`*`).
@@ -1969,7 +1915,7 @@ class Elasticsearch(BaseClient):
1969
1915
  <p>A document's source is not available if it is disabled in the mapping.</p>
1970
1916
 
1971
1917
 
1972
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-get.html>`_
1918
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-get>`_
1973
1919
 
1974
1920
  :param index: A comma-separated list of data streams, indices, and aliases. It
1975
1921
  supports wildcards (`*`).
@@ -2075,7 +2021,7 @@ class Elasticsearch(BaseClient):
2075
2021
  It computes a score explanation for a query and a specific document.</p>
2076
2022
 
2077
2023
 
2078
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-explain.html>`_
2024
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-explain>`_
2079
2025
 
2080
2026
  :param index: Index names that are used to limit the request. Only a single index
2081
2027
  name can be provided to this parameter.
@@ -2210,7 +2156,7 @@ class Elasticsearch(BaseClient):
2210
2156
  For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the <code>keyword</code> family.</p>
2211
2157
 
2212
2158
 
2213
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-field-caps.html>`_
2159
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-field-caps>`_
2214
2160
 
2215
2161
  :param index: A comma-separated list of data streams, indices, and aliases used
2216
2162
  to limit the request. Supports wildcards (*). To target all data streams
@@ -2371,7 +2317,7 @@ class Elasticsearch(BaseClient):
2371
2317
  Elasticsearch cleans up deleted documents in the background as you continue to index more data.</p>
2372
2318
 
2373
2319
 
2374
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-get.html>`_
2320
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-get>`_
2375
2321
 
2376
2322
  :param index: The name of the index that contains the document.
2377
2323
  :param id: A unique document identifier.
@@ -2478,7 +2424,7 @@ class Elasticsearch(BaseClient):
2478
2424
  Retrieves a stored script or search template.</p>
2479
2425
 
2480
2426
 
2481
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/modules-scripting.html>`_
2427
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-get-script>`_
2482
2428
 
2483
2429
  :param id: The identifier for the stored script or search template.
2484
2430
  :param master_timeout: The period to wait for the master node. If the master
@@ -2527,7 +2473,7 @@ class Elasticsearch(BaseClient):
2527
2473
  <p>Get a list of supported script contexts and their methods.</p>
2528
2474
 
2529
2475
 
2530
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/get-script-contexts-api.html>`_
2476
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-get-script-context>`_
2531
2477
  """
2532
2478
  __path_parts: t.Dict[str, str] = {}
2533
2479
  __path = "/_script_context"
@@ -2566,7 +2512,7 @@ class Elasticsearch(BaseClient):
2566
2512
  <p>Get a list of available script types, languages, and contexts.</p>
2567
2513
 
2568
2514
 
2569
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/get-script-languages-api.html>`_
2515
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-get-script-languages>`_
2570
2516
  """
2571
2517
  __path_parts: t.Dict[str, str] = {}
2572
2518
  __path = "/_script_language"
@@ -2631,7 +2577,7 @@ class Elasticsearch(BaseClient):
2631
2577
  </code></pre>
2632
2578
 
2633
2579
 
2634
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-get.html>`_
2580
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-get>`_
2635
2581
 
2636
2582
  :param index: The name of the index that contains the document.
2637
2583
  :param id: A unique document identifier.
@@ -2731,7 +2677,7 @@ class Elasticsearch(BaseClient):
2731
2677
  When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic.</p>
2732
2678
 
2733
2679
 
2734
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/health-api.html>`_
2680
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-health-report>`_
2735
2681
 
2736
2682
  :param feature: A feature of the cluster, as returned by the top-level health
2737
2683
  report API.
@@ -2786,6 +2732,7 @@ class Elasticsearch(BaseClient):
2786
2732
  human: t.Optional[bool] = None,
2787
2733
  if_primary_term: t.Optional[int] = None,
2788
2734
  if_seq_no: t.Optional[int] = None,
2735
+ include_source_on_error: t.Optional[bool] = None,
2789
2736
  op_type: t.Optional[t.Union[str, t.Literal["create", "index"]]] = None,
2790
2737
  pipeline: t.Optional[str] = None,
2791
2738
  pretty: t.Optional[bool] = None,
@@ -2842,9 +2789,7 @@ class Elasticsearch(BaseClient):
2842
2789
  This does come at the (very minimal) cost of an additional document parsing pass.
2843
2790
  If the <code>_routing</code> mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.</p>
2844
2791
  <p>NOTE: Data streams do not support custom routing unless they were created with the <code>allow_custom_routing</code> setting enabled in the template.</p>
2845
- <ul>
2846
- <li>** Distributed**</li>
2847
- </ul>
2792
+ <p><strong>Distributed</strong></p>
2848
2793
  <p>The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard.
2849
2794
  After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.</p>
2850
2795
  <p><strong>Active shards</strong></p>
@@ -2897,7 +2842,7 @@ class Elasticsearch(BaseClient):
2897
2842
  </code></pre>
2898
2843
 
2899
2844
 
2900
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-index_.html>`_
2845
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-create>`_
2901
2846
 
2902
2847
  :param index: The name of the data stream or index to target. If the target doesn't
2903
2848
  exist and matches the name or wildcard (`*`) pattern of an index template
@@ -2913,6 +2858,8 @@ class Elasticsearch(BaseClient):
2913
2858
  term.
2914
2859
  :param if_seq_no: Only perform the operation if the document has this sequence
2915
2860
  number.
2861
+ :param include_source_on_error: True or false if to include the document source
2862
+ in the error message in case of parsing errors.
2916
2863
  :param op_type: Set to `create` to only index the document if it does not already
2917
2864
  exist (put if absent). If a document with the specified `_id` already exists,
2918
2865
  the indexing operation will fail. The behavior is the same as using the `<index>/_create`
@@ -2977,6 +2924,8 @@ class Elasticsearch(BaseClient):
2977
2924
  __query["if_primary_term"] = if_primary_term
2978
2925
  if if_seq_no is not None:
2979
2926
  __query["if_seq_no"] = if_seq_no
2927
+ if include_source_on_error is not None:
2928
+ __query["include_source_on_error"] = include_source_on_error
2980
2929
  if op_type is not None:
2981
2930
  __query["op_type"] = op_type
2982
2931
  if pipeline is not None:
@@ -3025,7 +2974,7 @@ class Elasticsearch(BaseClient):
3025
2974
  Get basic build, version, and cluster information.</p>
3026
2975
 
3027
2976
 
3028
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/rest-api-root.html>`_
2977
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/group/endpoint-info>`_
3029
2978
  """
3030
2979
  __path_parts: t.Dict[str, str] = {}
3031
2980
  __path = "/"
@@ -3048,127 +2997,6 @@ class Elasticsearch(BaseClient):
3048
2997
  path_parts=__path_parts,
3049
2998
  )
3050
2999
 
3051
- @_rewrite_parameters(
3052
- body_fields=(
3053
- "knn",
3054
- "docvalue_fields",
3055
- "fields",
3056
- "filter",
3057
- "source",
3058
- "stored_fields",
3059
- ),
3060
- parameter_aliases={"_source": "source"},
3061
- )
3062
- @_stability_warning(Stability.EXPERIMENTAL)
3063
- def knn_search(
3064
- self,
3065
- *,
3066
- index: t.Union[str, t.Sequence[str]],
3067
- knn: t.Optional[t.Mapping[str, t.Any]] = None,
3068
- docvalue_fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
3069
- error_trace: t.Optional[bool] = None,
3070
- fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3071
- filter: t.Optional[
3072
- t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
3073
- ] = None,
3074
- filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3075
- human: t.Optional[bool] = None,
3076
- pretty: t.Optional[bool] = None,
3077
- routing: t.Optional[str] = None,
3078
- source: t.Optional[t.Union[bool, t.Mapping[str, t.Any]]] = None,
3079
- stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3080
- body: t.Optional[t.Dict[str, t.Any]] = None,
3081
- ) -> ObjectApiResponse[t.Any]:
3082
- """
3083
- .. raw:: html
3084
-
3085
- <p>Run a knn search.</p>
3086
- <p>NOTE: The kNN search API has been replaced by the <code>knn</code> option in the search API.</p>
3087
- <p>Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents.
3088
- Given a query vector, the API finds the k closest vectors and returns those documents as search hits.</p>
3089
- <p>Elasticsearch uses the HNSW algorithm to support efficient kNN search.
3090
- Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed.
3091
- This means the results returned are not always the true k closest neighbors.</p>
3092
- <p>The kNN search API supports restricting the search using a filter.
3093
- The search will return the top k documents that also match the filter query.</p>
3094
- <p>A kNN search response has the exact same structure as a search API response.
3095
- However, certain sections have a meaning specific to kNN search:</p>
3096
- <ul>
3097
- <li>The document <code>_score</code> is determined by the similarity between the query and document vector.</li>
3098
- <li>The <code>hits.total</code> object contains the total number of nearest neighbor candidates considered, which is <code>num_candidates * num_shards</code>. The <code>hits.total.relation</code> will always be <code>eq</code>, indicating an exact value.</li>
3099
- </ul>
3100
-
3101
-
3102
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/knn-search-api.html>`_
3103
-
3104
- :param index: A comma-separated list of index names to search; use `_all` or
3105
- to perform the operation on all indices.
3106
- :param knn: The kNN query to run.
3107
- :param docvalue_fields: The request returns doc values for field names matching
3108
- these patterns in the `hits.fields` property of the response. It accepts
3109
- wildcard (`*`) patterns.
3110
- :param fields: The request returns values for field names matching these patterns
3111
- in the `hits.fields` property of the response. It accepts wildcard (`*`)
3112
- patterns.
3113
- :param filter: A query to filter the documents that can match. The kNN search
3114
- will return the top `k` documents that also match this filter. The value
3115
- can be a single query or a list of queries. If `filter` isn't provided, all
3116
- documents are allowed to match.
3117
- :param routing: A comma-separated list of specific routing values.
3118
- :param source: Indicates which source fields are returned for matching documents.
3119
- These fields are returned in the `hits._source` property of the search response.
3120
- :param stored_fields: A list of stored fields to return as part of a hit. If
3121
- no fields are specified, no stored fields are included in the response. If
3122
- this field is specified, the `_source` parameter defaults to `false`. You
3123
- can pass `_source: true` to return both source fields and stored fields in
3124
- the search response.
3125
- """
3126
- if index in SKIP_IN_PATH:
3127
- raise ValueError("Empty value passed for parameter 'index'")
3128
- if knn is None and body is None:
3129
- raise ValueError("Empty value passed for parameter 'knn'")
3130
- __path_parts: t.Dict[str, str] = {"index": _quote(index)}
3131
- __path = f'/{__path_parts["index"]}/_knn_search'
3132
- __query: t.Dict[str, t.Any] = {}
3133
- __body: t.Dict[str, t.Any] = body if body is not None else {}
3134
- if error_trace is not None:
3135
- __query["error_trace"] = error_trace
3136
- if filter_path is not None:
3137
- __query["filter_path"] = filter_path
3138
- if human is not None:
3139
- __query["human"] = human
3140
- if pretty is not None:
3141
- __query["pretty"] = pretty
3142
- if routing is not None:
3143
- __query["routing"] = routing
3144
- if not __body:
3145
- if knn is not None:
3146
- __body["knn"] = knn
3147
- if docvalue_fields is not None:
3148
- __body["docvalue_fields"] = docvalue_fields
3149
- if fields is not None:
3150
- __body["fields"] = fields
3151
- if filter is not None:
3152
- __body["filter"] = filter
3153
- if source is not None:
3154
- __body["_source"] = source
3155
- if stored_fields is not None:
3156
- __body["stored_fields"] = stored_fields
3157
- if not __body:
3158
- __body = None # type: ignore[assignment]
3159
- __headers = {"accept": "application/json"}
3160
- if __body is not None:
3161
- __headers["content-type"] = "application/json"
3162
- return self.perform_request( # type: ignore[return-value]
3163
- "POST",
3164
- __path,
3165
- params=__query,
3166
- headers=__headers,
3167
- body=__body,
3168
- endpoint_id="knn_search",
3169
- path_parts=__path_parts,
3170
- )
3171
-
3172
3000
  @_rewrite_parameters(
3173
3001
  body_fields=("docs", "ids"),
3174
3002
  parameter_aliases={
@@ -3215,7 +3043,7 @@ class Elasticsearch(BaseClient):
3215
3043
  You can include the <code>stored_fields</code> query parameter in the request URI to specify the defaults to use when there are no per-document instructions.</p>
3216
3044
 
3217
3045
 
3218
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-multi-get.html>`_
3046
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-mget>`_
3219
3047
 
3220
3048
  :param index: Name of the index to retrieve documents from when `ids` are specified,
3221
3049
  or when a document in the `docs` array does not specify an index.
@@ -3350,7 +3178,7 @@ class Elasticsearch(BaseClient):
3350
3178
  When sending requests to this endpoint the <code>Content-Type</code> header should be set to <code>application/x-ndjson</code>.</p>
3351
3179
 
3352
3180
 
3353
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-multi-search.html>`_
3181
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-msearch>`_
3354
3182
 
3355
3183
  :param searches:
3356
3184
  :param index: Comma-separated list of data streams, indices, and index aliases
@@ -3377,7 +3205,8 @@ class Elasticsearch(BaseClient):
3377
3205
  computationally expensive named queries on a large number of hits may add
3378
3206
  significant overhead.
3379
3207
  :param max_concurrent_searches: Maximum number of concurrent searches the multi
3380
- search API can execute.
3208
+ search API can execute. Defaults to `max(1, (# of data nodes * min(search
3209
+ thread pool size, 10)))`.
3381
3210
  :param max_concurrent_shard_requests: Maximum number of concurrent shard requests
3382
3211
  that each sub-search request executes per node.
3383
3212
  :param pre_filter_shard_size: Defines a threshold that enforces a pre-filter
@@ -3496,7 +3325,7 @@ class Elasticsearch(BaseClient):
3496
3325
  </code></pre>
3497
3326
 
3498
3327
 
3499
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/multi-search-template.html>`_
3328
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-msearch-template>`_
3500
3329
 
3501
3330
  :param search_templates:
3502
3331
  :param index: A comma-separated list of data streams, indices, and aliases to
@@ -3601,7 +3430,7 @@ class Elasticsearch(BaseClient):
3601
3430
  The mapping used is determined by the specified <code>_index</code>.</p>
3602
3431
 
3603
3432
 
3604
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-multi-termvectors.html>`_
3433
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-mtermvectors>`_
3605
3434
 
3606
3435
  :param index: The name of the index that contains the documents.
3607
3436
  :param docs: An array of existing or artificial documents.
@@ -3705,6 +3534,7 @@ class Elasticsearch(BaseClient):
3705
3534
  human: t.Optional[bool] = None,
3706
3535
  ignore_unavailable: t.Optional[bool] = None,
3707
3536
  index_filter: t.Optional[t.Mapping[str, t.Any]] = None,
3537
+ max_concurrent_shard_requests: t.Optional[int] = None,
3708
3538
  preference: t.Optional[str] = None,
3709
3539
  pretty: t.Optional[bool] = None,
3710
3540
  routing: t.Optional[str] = None,
@@ -3741,7 +3571,7 @@ class Elasticsearch(BaseClient):
3741
3571
  You can check how many point-in-times (that is, search contexts) are open with the nodes stats API.</p>
3742
3572
 
3743
3573
 
3744
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/point-in-time-api.html>`_
3574
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-open-point-in-time>`_
3745
3575
 
3746
3576
  :param index: A comma-separated list of index names to open point in time; use
3747
3577
  `_all` or empty string to perform the operation on all indices
@@ -3760,6 +3590,8 @@ class Elasticsearch(BaseClient):
3760
3590
  a missing or closed index.
3761
3591
  :param index_filter: Filter indices if the provided query rewrites to `match_none`
3762
3592
  on every shard.
3593
+ :param max_concurrent_shard_requests: Maximum number of concurrent shard requests
3594
+ that each sub-search request executes per node.
3763
3595
  :param preference: The node or shard the operation should be performed on. By
3764
3596
  default, it is random.
3765
3597
  :param routing: A custom value that is used to route operations to a specific
@@ -3787,6 +3619,8 @@ class Elasticsearch(BaseClient):
3787
3619
  __query["human"] = human
3788
3620
  if ignore_unavailable is not None:
3789
3621
  __query["ignore_unavailable"] = ignore_unavailable
3622
+ if max_concurrent_shard_requests is not None:
3623
+ __query["max_concurrent_shard_requests"] = max_concurrent_shard_requests
3790
3624
  if preference is not None:
3791
3625
  __query["preference"] = preference
3792
3626
  if pretty is not None:
@@ -3835,7 +3669,7 @@ class Elasticsearch(BaseClient):
3835
3669
  Creates or updates a stored script or search template.</p>
3836
3670
 
3837
3671
 
3838
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/create-stored-script-api.html>`_
3672
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-put-script>`_
3839
3673
 
3840
3674
  :param id: The identifier for the stored script or search template. It must be
3841
3675
  unique within the cluster.
@@ -3925,7 +3759,7 @@ class Elasticsearch(BaseClient):
3925
3759
  <p>Evaluate the quality of ranked search results over a set of typical search queries.</p>
3926
3760
 
3927
3761
 
3928
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-rank-eval.html>`_
3762
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-rank-eval>`_
3929
3763
 
3930
3764
  :param requests: A set of typical search requests, together with their provided
3931
3765
  ratings.
@@ -4073,7 +3907,7 @@ class Elasticsearch(BaseClient):
4073
3907
  }'
4074
3908
  done
4075
3909
  </code></pre>
4076
- <p>** Throttling**</p>
3910
+ <p><strong>Throttling</strong></p>
4077
3911
  <p>Set <code>requests_per_second</code> to any positive decimal number (<code>1.4</code>, <code>6</code>, <code>1000</code>, for example) to throttle the rate at which reindex issues batches of index operations.
4078
3912
  Requests are throttled by padding each batch with a wait time.
4079
3913
  To turn off throttling, set <code>requests_per_second</code> to <code>-1</code>.</p>
@@ -4157,7 +3991,7 @@ class Elasticsearch(BaseClient):
4157
3991
  It is not possible to configure SSL in the body of the reindex request.</p>
4158
3992
 
4159
3993
 
4160
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-reindex.html>`_
3994
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-reindex>`_
4161
3995
 
4162
3996
  :param dest: The destination you are copying to.
4163
3997
  :param source: The source you are copying from.
@@ -4281,7 +4115,7 @@ class Elasticsearch(BaseClient):
4281
4115
  This behavior prevents scroll timeouts.</p>
4282
4116
 
4283
4117
 
4284
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-reindex.html>`_
4118
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-reindex>`_
4285
4119
 
4286
4120
  :param task_id: The task identifier, which can be found by using the tasks API.
4287
4121
  :param requests_per_second: The throttle for this request in sub-requests per
@@ -4327,7 +4161,7 @@ class Elasticsearch(BaseClient):
4327
4161
  human: t.Optional[bool] = None,
4328
4162
  params: t.Optional[t.Mapping[str, t.Any]] = None,
4329
4163
  pretty: t.Optional[bool] = None,
4330
- source: t.Optional[str] = None,
4164
+ source: t.Optional[t.Union[str, t.Mapping[str, t.Any]]] = None,
4331
4165
  body: t.Optional[t.Dict[str, t.Any]] = None,
4332
4166
  ) -> ObjectApiResponse[t.Any]:
4333
4167
  """
@@ -4337,7 +4171,7 @@ class Elasticsearch(BaseClient):
4337
4171
  <p>Render a search template as a search request body.</p>
4338
4172
 
4339
4173
 
4340
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/render-search-template-api.html>`_
4174
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-render-search-template>`_
4341
4175
 
4342
4176
  :param id: The ID of the search template to render. If no `source` is specified,
4343
4177
  this or the `id` request body parameter is required.
@@ -4394,7 +4228,24 @@ class Elasticsearch(BaseClient):
4394
4228
  def scripts_painless_execute(
4395
4229
  self,
4396
4230
  *,
4397
- context: t.Optional[str] = None,
4231
+ context: t.Optional[
4232
+ t.Union[
4233
+ str,
4234
+ t.Literal[
4235
+ "boolean_field",
4236
+ "composite_field",
4237
+ "date_field",
4238
+ "double_field",
4239
+ "filter",
4240
+ "geo_point_field",
4241
+ "ip_field",
4242
+ "keyword_field",
4243
+ "long_field",
4244
+ "painless_test",
4245
+ "score",
4246
+ ],
4247
+ ]
4248
+ ] = None,
4398
4249
  context_setup: t.Optional[t.Mapping[str, t.Any]] = None,
4399
4250
  error_trace: t.Optional[bool] = None,
4400
4251
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
@@ -4406,15 +4257,22 @@ class Elasticsearch(BaseClient):
4406
4257
  """
4407
4258
  .. raw:: html
4408
4259
 
4409
- <p>Run a script.
4410
- Runs a script and returns a result.</p>
4260
+ <p>Run a script.</p>
4261
+ <p>Runs a script and returns a result.
4262
+ Use this API to build and test scripts, such as when defining a script for a runtime field.
4263
+ This API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster.</p>
4264
+ <p>The API uses several <em>contexts</em>, which control how scripts are run, what variables are available at runtime, and what the return type is.</p>
4265
+ <p>Each context requires a script, but additional parameters depend on the context you're using for that script.</p>
4411
4266
 
4412
4267
 
4413
- `<https://www.elastic.co/guide/en/elasticsearch/painless/8.17/painless-execute-api.html>`_
4268
+ `<https://www.elastic.co/docs/reference/scripting-languages/painless/painless-api-examples>`_
4414
4269
 
4415
- :param context: The context that the script should run in.
4416
- :param context_setup: Additional parameters for the `context`.
4417
- :param script: The Painless script to execute.
4270
+ :param context: The context that the script should run in. NOTE: Result ordering
4271
+ in the field contexts is not guaranteed.
4272
+ :param context_setup: Additional parameters for the `context`. NOTE: This parameter
4273
+ is required for all contexts except `painless_test`, which is the default
4274
+ if no value is provided for `context`.
4275
+ :param script: The Painless script to run.
4418
4276
  """
4419
4277
  __path_parts: t.Dict[str, str] = {}
4420
4278
  __path = "/_scripts/painless/_execute"
@@ -4480,7 +4338,7 @@ class Elasticsearch(BaseClient):
4480
4338
  <p>IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.</p>
4481
4339
 
4482
4340
 
4483
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/scroll-api.html>`_
4341
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-scroll>`_
4484
4342
 
4485
4343
  :param scroll_id: The scroll ID of the search.
4486
4344
  :param rest_total_hits_as_int: If true, the API response’s hit.total property
@@ -4611,7 +4469,6 @@ class Elasticsearch(BaseClient):
4611
4469
  ] = None,
4612
4470
  lenient: t.Optional[bool] = None,
4613
4471
  max_concurrent_shard_requests: t.Optional[int] = None,
4614
- min_compatible_shard_node: t.Optional[str] = None,
4615
4472
  min_score: t.Optional[float] = None,
4616
4473
  pit: t.Optional[t.Mapping[str, t.Any]] = None,
4617
4474
  post_filter: t.Optional[t.Mapping[str, t.Any]] = None,
@@ -4633,7 +4490,7 @@ class Elasticsearch(BaseClient):
4633
4490
  script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
4634
4491
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4635
4492
  search_after: t.Optional[
4636
- t.Sequence[t.Union[None, bool, float, int, str, t.Any]]
4493
+ t.Sequence[t.Union[None, bool, float, int, str]]
4637
4494
  ] = None,
4638
4495
  search_type: t.Optional[
4639
4496
  t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]]
@@ -4686,7 +4543,7 @@ class Elasticsearch(BaseClient):
4686
4543
  This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.</p>
4687
4544
 
4688
4545
 
4689
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-search.html>`_
4546
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search>`_
4690
4547
 
4691
4548
  :param index: A comma-separated list of data streams, indices, and aliases to
4692
4549
  search. It supports wildcards (`*`). To search all data streams and indices,
@@ -4764,10 +4621,9 @@ class Elasticsearch(BaseClient):
4764
4621
  per node that the search runs concurrently. This value should be used to
4765
4622
  limit the impact of the search on the cluster in order to limit the number
4766
4623
  of concurrent shard requests.
4767
- :param min_compatible_shard_node: The minimum version of the node that can handle
4768
- the request. Any handling node with a lower version will fail the request.
4769
4624
  :param min_score: The minimum `_score` for matching documents. Documents with
4770
- a lower `_score` are not included in the search results.
4625
+ a lower `_score` are not included in search results and results collected
4626
+ by aggregations.
4771
4627
  :param pit: Limit the search to a point in time (PIT). If you provide a PIT,
4772
4628
  you cannot specify an `<index>` in the request path.
4773
4629
  :param post_filter: Use the `post_filter` parameter to filter search results.
@@ -4786,18 +4642,19 @@ class Elasticsearch(BaseClient):
4786
4642
  :param preference: The nodes and shards used for the search. By default, Elasticsearch
4787
4643
  selects from eligible nodes and shards using adaptive replica selection,
4788
4644
  accounting for allocation awareness. Valid values are: * `_only_local` to
4789
- run the search only on shards on the local node; * `_local` to, if possible,
4645
+ run the search only on shards on the local node. * `_local` to, if possible,
4790
4646
  run the search on shards on the local node, or if not, select shards using
4791
- the default method; * `_only_nodes:<node-id>,<node-id>` to run the search
4792
- on only the specified nodes IDs, where, if suitable shards exist on more
4793
- than one selected node, use shards on those nodes using the default method,
4794
- or if none of the specified nodes are available, select shards from any available
4795
- node using the default method; * `_prefer_nodes:<node-id>,<node-id>` to if
4796
- possible, run the search on the specified nodes IDs, or if not, select shards
4797
- using the default method; * `_shards:<shard>,<shard>` to run the search only
4798
- on the specified shards; * `<custom-string>` (any string that does not start
4799
- with `_`) to route searches with the same `<custom-string>` to the same shards
4800
- in the same order.
4647
+ the default method. * `_only_nodes:<node-id>,<node-id>` to run the search
4648
+ on only the specified nodes IDs. If suitable shards exist on more than one
4649
+ selected node, use shards on those nodes using the default method. If none
4650
+ of the specified nodes are available, select shards from any available node
4651
+ using the default method. * `_prefer_nodes:<node-id>,<node-id>` to if possible,
4652
+ run the search on the specified nodes IDs. If not, select shards using the
4653
+ default method. `_shards:<shard>,<shard>` to run the search only on the specified
4654
+ shards. You can combine this value with other `preference` values. However,
4655
+ the `_shards` value must come first. For example: `_shards:2,3|_local`. `<custom-string>`
4656
+ (any string that does not start with `_`) to route searches with the same
4657
+ `<custom-string>` to the same shards in the same order.
4801
4658
  :param profile: Set to `true` to return detailed timing information about the
4802
4659
  execution of individual components in a search request. NOTE: This is a debugging
4803
4660
  tool and adds significant overhead to search execution.
@@ -4948,8 +4805,6 @@ class Elasticsearch(BaseClient):
4948
4805
  __query["lenient"] = lenient
4949
4806
  if max_concurrent_shard_requests is not None:
4950
4807
  __query["max_concurrent_shard_requests"] = max_concurrent_shard_requests
4951
- if min_compatible_shard_node is not None:
4952
- __query["min_compatible_shard_node"] = min_compatible_shard_node
4953
4808
  if pre_filter_shard_size is not None:
4954
4809
  __query["pre_filter_shard_size"] = pre_filter_shard_size
4955
4810
  if preference is not None:
@@ -5436,7 +5291,7 @@ class Elasticsearch(BaseClient):
5436
5291
  Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density.</p>
5437
5292
 
5438
5293
 
5439
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-vector-tile-api.html>`_
5294
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-mvt>`_
5440
5295
 
5441
5296
  :param index: Comma-separated list of data streams, indices, or aliases to search
5442
5297
  :param field: Field containing geospatial data to return
@@ -5595,6 +5450,7 @@ class Elasticsearch(BaseClient):
5595
5450
  human: t.Optional[bool] = None,
5596
5451
  ignore_unavailable: t.Optional[bool] = None,
5597
5452
  local: t.Optional[bool] = None,
5453
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
5598
5454
  preference: t.Optional[str] = None,
5599
5455
  pretty: t.Optional[bool] = None,
5600
5456
  routing: t.Optional[str] = None,
@@ -5609,7 +5465,7 @@ class Elasticsearch(BaseClient):
5609
5465
  <p>If the Elasticsearch security features are enabled, you must have the <code>view_index_metadata</code> or <code>manage</code> index privilege for the target data stream, index, or alias.</p>
5610
5466
 
5611
5467
 
5612
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-shards.html>`_
5468
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-shards>`_
5613
5469
 
5614
5470
  :param index: A comma-separated list of data streams, indices, and aliases to
5615
5471
  search. It supports wildcards (`*`). To search all data streams and indices,
@@ -5627,6 +5483,10 @@ class Elasticsearch(BaseClient):
5627
5483
  a missing or closed index.
5628
5484
  :param local: If `true`, the request retrieves information from the local node
5629
5485
  only.
5486
+ :param master_timeout: The period to wait for a connection to the master node.
5487
+ If the master node is not available before the timeout expires, the request
5488
+ fails and returns an error. IT can also be set to `-1` to indicate that the
5489
+ request should never timeout.
5630
5490
  :param preference: The node or shard the operation should be performed on. It
5631
5491
  is random by default.
5632
5492
  :param routing: A custom value used to route operations to a specific shard.
@@ -5653,6 +5513,8 @@ class Elasticsearch(BaseClient):
5653
5513
  __query["ignore_unavailable"] = ignore_unavailable
5654
5514
  if local is not None:
5655
5515
  __query["local"] = local
5516
+ if master_timeout is not None:
5517
+ __query["master_timeout"] = master_timeout
5656
5518
  if preference is not None:
5657
5519
  __query["preference"] = preference
5658
5520
  if pretty is not None:
@@ -5704,7 +5566,7 @@ class Elasticsearch(BaseClient):
5704
5566
  search_type: t.Optional[
5705
5567
  t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]]
5706
5568
  ] = None,
5707
- source: t.Optional[str] = None,
5569
+ source: t.Optional[t.Union[str, t.Mapping[str, t.Any]]] = None,
5708
5570
  typed_keys: t.Optional[bool] = None,
5709
5571
  body: t.Optional[t.Dict[str, t.Any]] = None,
5710
5572
  ) -> ObjectApiResponse[t.Any]:
@@ -5714,7 +5576,7 @@ class Elasticsearch(BaseClient):
5714
5576
  <p>Run a search with a search template.</p>
5715
5577
 
5716
5578
 
5717
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-template-api.html>`_
5579
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-template>`_
5718
5580
 
5719
5581
  :param index: A comma-separated list of data streams, indices, and aliases to
5720
5582
  search. It supports wildcards (`*`).
@@ -5857,7 +5719,7 @@ class Elasticsearch(BaseClient):
5857
5719
  </blockquote>
5858
5720
 
5859
5721
 
5860
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/search-terms-enum.html>`_
5722
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-terms-enum>`_
5861
5723
 
5862
5724
  :param index: A comma-separated list of data streams, indices, and index aliases
5863
5725
  to search. Wildcard (`*`) expressions are supported. To search all data streams
@@ -5927,7 +5789,20 @@ class Elasticsearch(BaseClient):
5927
5789
  )
5928
5790
 
5929
5791
  @_rewrite_parameters(
5930
- body_fields=("doc", "filter", "per_field_analyzer"),
5792
+ body_fields=(
5793
+ "doc",
5794
+ "field_statistics",
5795
+ "fields",
5796
+ "filter",
5797
+ "offsets",
5798
+ "payloads",
5799
+ "per_field_analyzer",
5800
+ "positions",
5801
+ "routing",
5802
+ "term_statistics",
5803
+ "version",
5804
+ "version_type",
5805
+ ),
5931
5806
  )
5932
5807
  def termvectors(
5933
5808
  self,
@@ -5993,7 +5868,7 @@ class Elasticsearch(BaseClient):
5993
5868
  Use <code>routing</code> only to hit a particular shard.</p>
5994
5869
 
5995
5870
 
5996
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-termvectors.html>`_
5871
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-termvectors>`_
5997
5872
 
5998
5873
  :param index: The name of the index that contains the document.
5999
5874
  :param id: A unique identifier for the document.
@@ -6004,9 +5879,9 @@ class Elasticsearch(BaseClient):
6004
5879
  (the sum of document frequencies for all terms in this field). * The sum
6005
5880
  of total term frequencies (the sum of total term frequencies of each term
6006
5881
  in this field).
6007
- :param fields: A comma-separated list or wildcard expressions of fields to include
6008
- in the statistics. It is used as the default list unless a specific field
6009
- list is provided in the `completion_fields` or `fielddata_fields` parameters.
5882
+ :param fields: A list of fields to include in the statistics. It is used as the
5883
+ default list unless a specific field list is provided in the `completion_fields`
5884
+ or `fielddata_fields` parameters.
6010
5885
  :param filter: Filter terms based on their tf-idf scores. This could be useful
6011
5886
  in order find out a good characteristic vector of a document. This feature
6012
5887
  works in a similar manner to the second phase of the More Like This Query.
@@ -6044,41 +5919,41 @@ class Elasticsearch(BaseClient):
6044
5919
  __body: t.Dict[str, t.Any] = body if body is not None else {}
6045
5920
  if error_trace is not None:
6046
5921
  __query["error_trace"] = error_trace
6047
- if field_statistics is not None:
6048
- __query["field_statistics"] = field_statistics
6049
- if fields is not None:
6050
- __query["fields"] = fields
6051
5922
  if filter_path is not None:
6052
5923
  __query["filter_path"] = filter_path
6053
5924
  if human is not None:
6054
5925
  __query["human"] = human
6055
- if offsets is not None:
6056
- __query["offsets"] = offsets
6057
- if payloads is not None:
6058
- __query["payloads"] = payloads
6059
- if positions is not None:
6060
- __query["positions"] = positions
6061
5926
  if preference is not None:
6062
5927
  __query["preference"] = preference
6063
5928
  if pretty is not None:
6064
5929
  __query["pretty"] = pretty
6065
5930
  if realtime is not None:
6066
5931
  __query["realtime"] = realtime
6067
- if routing is not None:
6068
- __query["routing"] = routing
6069
- if term_statistics is not None:
6070
- __query["term_statistics"] = term_statistics
6071
- if version is not None:
6072
- __query["version"] = version
6073
- if version_type is not None:
6074
- __query["version_type"] = version_type
6075
5932
  if not __body:
6076
5933
  if doc is not None:
6077
5934
  __body["doc"] = doc
5935
+ if field_statistics is not None:
5936
+ __body["field_statistics"] = field_statistics
5937
+ if fields is not None:
5938
+ __body["fields"] = fields
6078
5939
  if filter is not None:
6079
5940
  __body["filter"] = filter
5941
+ if offsets is not None:
5942
+ __body["offsets"] = offsets
5943
+ if payloads is not None:
5944
+ __body["payloads"] = payloads
6080
5945
  if per_field_analyzer is not None:
6081
5946
  __body["per_field_analyzer"] = per_field_analyzer
5947
+ if positions is not None:
5948
+ __body["positions"] = positions
5949
+ if routing is not None:
5950
+ __body["routing"] = routing
5951
+ if term_statistics is not None:
5952
+ __body["term_statistics"] = term_statistics
5953
+ if version is not None:
5954
+ __body["version"] = version
5955
+ if version_type is not None:
5956
+ __body["version_type"] = version_type
6082
5957
  if not __body:
6083
5958
  __body = None # type: ignore[assignment]
6084
5959
  __headers = {"accept": "application/json"}
@@ -6123,6 +5998,7 @@ class Elasticsearch(BaseClient):
6123
5998
  human: t.Optional[bool] = None,
6124
5999
  if_primary_term: t.Optional[int] = None,
6125
6000
  if_seq_no: t.Optional[int] = None,
6001
+ include_source_on_error: t.Optional[bool] = None,
6126
6002
  lang: t.Optional[str] = None,
6127
6003
  pretty: t.Optional[bool] = None,
6128
6004
  refresh: t.Optional[
@@ -6163,7 +6039,7 @@ class Elasticsearch(BaseClient):
6163
6039
  In addition to <code>_source</code>, you can access the following variables through the <code>ctx</code> map: <code>_index</code>, <code>_type</code>, <code>_id</code>, <code>_version</code>, <code>_routing</code>, and <code>_now</code> (the current timestamp).</p>
6164
6040
 
6165
6041
 
6166
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-update.html>`_
6042
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-update>`_
6167
6043
 
6168
6044
  :param index: The name of the target index. By default, the index is created
6169
6045
  automatically if it doesn't exist.
@@ -6178,6 +6054,8 @@ class Elasticsearch(BaseClient):
6178
6054
  term.
6179
6055
  :param if_seq_no: Only perform the operation if the document has this sequence
6180
6056
  number.
6057
+ :param include_source_on_error: True or false if to include the document source
6058
+ in the error message in case of parsing errors.
6181
6059
  :param lang: The script language.
6182
6060
  :param refresh: If 'true', Elasticsearch refreshes the affected shards to make
6183
6061
  this operation visible to search. If 'wait_for', it waits for a refresh to
@@ -6222,6 +6100,8 @@ class Elasticsearch(BaseClient):
6222
6100
  __query["if_primary_term"] = if_primary_term
6223
6101
  if if_seq_no is not None:
6224
6102
  __query["if_seq_no"] = if_seq_no
6103
+ if include_source_on_error is not None:
6104
+ __query["include_source_on_error"] = include_source_on_error
6225
6105
  if lang is not None:
6226
6106
  __query["lang"] = lang
6227
6107
  if pretty is not None:
@@ -6397,7 +6277,7 @@ class Elasticsearch(BaseClient):
6397
6277
  This API enables you to only modify the source of matching documents; you cannot move them.</p>
6398
6278
 
6399
6279
 
6400
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-update-by-query.html>`_
6280
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-update-by-query>`_
6401
6281
 
6402
6282
  :param index: A comma-separated list of data streams, indices, and aliases to
6403
6283
  search. It supports wildcards (`*`). To search all data streams or indices,
@@ -6424,7 +6304,7 @@ class Elasticsearch(BaseClient):
6424
6304
  wildcard expressions match hidden data streams. It supports comma-separated
6425
6305
  values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`,
6426
6306
  `hidden`, `none`.
6427
- :param from_: Starting offset (default: 0)
6307
+ :param from_: Skips the specified number of documents.
6428
6308
  :param ignore_unavailable: If `false`, the request returns an error if it targets
6429
6309
  a missing or closed index.
6430
6310
  :param lenient: If `true`, format-based query failures (such as providing text
@@ -6617,7 +6497,7 @@ class Elasticsearch(BaseClient):
6617
6497
  Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.</p>
6618
6498
 
6619
6499
 
6620
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/docs-update-by-query.html#docs-update-by-query-rethrottle>`_
6500
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-update-by-query-rethrottle>`_
6621
6501
 
6622
6502
  :param task_id: The ID for the task.
6623
6503
  :param requests_per_second: The throttle for this request in sub-requests per