elasticsearch 8.19.1__py3-none-any.whl → 8.19.3__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 (112) hide show
  1. elasticsearch/_async/client/__init__.py +66 -67
  2. elasticsearch/_async/client/async_search.py +3 -3
  3. elasticsearch/_async/client/autoscaling.py +8 -4
  4. elasticsearch/_async/client/cat.py +521 -27
  5. elasticsearch/_async/client/ccr.py +2 -2
  6. elasticsearch/_async/client/cluster.py +10 -9
  7. elasticsearch/_async/client/connector.py +37 -36
  8. elasticsearch/_async/client/dangling_indices.py +6 -10
  9. elasticsearch/_async/client/eql.py +2 -2
  10. elasticsearch/_async/client/esql.py +1 -1
  11. elasticsearch/_async/client/features.py +2 -2
  12. elasticsearch/_async/client/fleet.py +4 -8
  13. elasticsearch/_async/client/graph.py +1 -5
  14. elasticsearch/_async/client/ilm.py +2 -10
  15. elasticsearch/_async/client/indices.py +393 -56
  16. elasticsearch/_async/client/inference.py +35 -121
  17. elasticsearch/_async/client/ingest.py +1 -1
  18. elasticsearch/_async/client/license.py +3 -5
  19. elasticsearch/_async/client/ml.py +61 -21
  20. elasticsearch/_async/client/monitoring.py +2 -1
  21. elasticsearch/_async/client/nodes.py +9 -9
  22. elasticsearch/_async/client/rollup.py +9 -9
  23. elasticsearch/_async/client/search_application.py +11 -11
  24. elasticsearch/_async/client/searchable_snapshots.py +4 -4
  25. elasticsearch/_async/client/security.py +4 -4
  26. elasticsearch/_async/client/shutdown.py +12 -17
  27. elasticsearch/_async/client/simulate.py +2 -2
  28. elasticsearch/_async/client/slm.py +2 -6
  29. elasticsearch/_async/client/snapshot.py +3 -2
  30. elasticsearch/_async/client/streams.py +185 -0
  31. elasticsearch/_async/client/tasks.py +4 -4
  32. elasticsearch/_async/client/text_structure.py +5 -1
  33. elasticsearch/_async/client/transform.py +37 -0
  34. elasticsearch/_async/client/utils.py +4 -2
  35. elasticsearch/_async/client/watcher.py +3 -7
  36. elasticsearch/_async/client/xpack.py +2 -1
  37. elasticsearch/_async/helpers.py +58 -9
  38. elasticsearch/_sync/client/__init__.py +68 -67
  39. elasticsearch/_sync/client/async_search.py +3 -3
  40. elasticsearch/_sync/client/autoscaling.py +8 -4
  41. elasticsearch/_sync/client/cat.py +521 -27
  42. elasticsearch/_sync/client/ccr.py +2 -2
  43. elasticsearch/_sync/client/cluster.py +10 -9
  44. elasticsearch/_sync/client/connector.py +37 -36
  45. elasticsearch/_sync/client/dangling_indices.py +6 -10
  46. elasticsearch/_sync/client/eql.py +2 -2
  47. elasticsearch/_sync/client/esql.py +1 -1
  48. elasticsearch/_sync/client/features.py +2 -2
  49. elasticsearch/_sync/client/fleet.py +4 -8
  50. elasticsearch/_sync/client/graph.py +1 -5
  51. elasticsearch/_sync/client/ilm.py +2 -10
  52. elasticsearch/_sync/client/indices.py +393 -56
  53. elasticsearch/_sync/client/inference.py +35 -121
  54. elasticsearch/_sync/client/ingest.py +1 -1
  55. elasticsearch/_sync/client/license.py +3 -5
  56. elasticsearch/_sync/client/ml.py +61 -21
  57. elasticsearch/_sync/client/monitoring.py +2 -1
  58. elasticsearch/_sync/client/nodes.py +9 -9
  59. elasticsearch/_sync/client/rollup.py +9 -9
  60. elasticsearch/_sync/client/search_application.py +11 -11
  61. elasticsearch/_sync/client/searchable_snapshots.py +4 -4
  62. elasticsearch/_sync/client/security.py +4 -4
  63. elasticsearch/_sync/client/shutdown.py +12 -17
  64. elasticsearch/_sync/client/simulate.py +2 -2
  65. elasticsearch/_sync/client/slm.py +2 -6
  66. elasticsearch/_sync/client/snapshot.py +3 -2
  67. elasticsearch/_sync/client/streams.py +185 -0
  68. elasticsearch/_sync/client/tasks.py +4 -4
  69. elasticsearch/_sync/client/text_structure.py +5 -1
  70. elasticsearch/_sync/client/transform.py +37 -0
  71. elasticsearch/_sync/client/utils.py +16 -2
  72. elasticsearch/_sync/client/watcher.py +3 -7
  73. elasticsearch/_sync/client/xpack.py +2 -1
  74. elasticsearch/_version.py +2 -1
  75. elasticsearch/client.py +2 -0
  76. elasticsearch/compat.py +45 -1
  77. elasticsearch/dsl/__init__.py +28 -0
  78. elasticsearch/dsl/_async/document.py +4 -5
  79. elasticsearch/dsl/_async/index.py +1 -1
  80. elasticsearch/dsl/_async/search.py +2 -3
  81. elasticsearch/dsl/_sync/document.py +4 -5
  82. elasticsearch/dsl/_sync/index.py +1 -1
  83. elasticsearch/dsl/_sync/search.py +2 -3
  84. elasticsearch/dsl/aggs.py +104 -7
  85. elasticsearch/dsl/async_connections.py +1 -2
  86. elasticsearch/dsl/connections.py +1 -2
  87. elasticsearch/dsl/document_base.py +16 -1
  88. elasticsearch/dsl/field.py +12 -1
  89. elasticsearch/dsl/query.py +24 -1
  90. elasticsearch/dsl/response/__init__.py +3 -0
  91. elasticsearch/dsl/serializer.py +1 -2
  92. elasticsearch/dsl/types.py +187 -9
  93. elasticsearch/dsl/utils.py +1 -2
  94. elasticsearch/esql/esql.py +1 -1
  95. elasticsearch/esql/functions.py +2 -2
  96. elasticsearch/helpers/__init__.py +10 -1
  97. elasticsearch/helpers/actions.py +106 -33
  98. elasticsearch/helpers/vectorstore/__init__.py +7 -7
  99. elasticsearch/helpers/vectorstore/_async/_utils.py +1 -1
  100. elasticsearch/helpers/vectorstore/_async/embedding_service.py +2 -2
  101. elasticsearch/helpers/vectorstore/_async/strategies.py +3 -3
  102. elasticsearch/helpers/vectorstore/_async/vectorstore.py +5 -5
  103. elasticsearch/helpers/vectorstore/_sync/_utils.py +1 -1
  104. elasticsearch/helpers/vectorstore/_sync/embedding_service.py +2 -2
  105. elasticsearch/helpers/vectorstore/_sync/strategies.py +3 -3
  106. elasticsearch/helpers/vectorstore/_sync/vectorstore.py +5 -5
  107. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.3.dist-info}/METADATA +2 -2
  108. elasticsearch-8.19.3.dist-info/RECORD +166 -0
  109. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.3.dist-info}/WHEEL +1 -1
  110. elasticsearch-8.19.1.dist-info/RECORD +0 -164
  111. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.3.dist-info}/licenses/LICENSE +0 -0
  112. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.3.dist-info}/licenses/NOTICE +0 -0
@@ -23,9 +23,9 @@ from ._base import NamespacedClient
23
23
  from .utils import (
24
24
  SKIP_IN_PATH,
25
25
  Stability,
26
+ _availability_warning,
26
27
  _quote,
27
28
  _rewrite_parameters,
28
- _stability_warning,
29
29
  )
30
30
 
31
31
 
@@ -232,11 +232,7 @@ class IndicesClient(NamespacedClient):
232
232
  __body["text"] = text
233
233
  if tokenizer is not None:
234
234
  __body["tokenizer"] = tokenizer
235
- if not __body:
236
- __body = None # type: ignore[assignment]
237
- __headers = {"accept": "application/json"}
238
- if __body is not None:
239
- __headers["content-type"] = "application/json"
235
+ __headers = {"accept": "application/json", "content-type": "application/json"}
240
236
  return self.perform_request( # type: ignore[return-value]
241
237
  "POST",
242
238
  __path,
@@ -248,7 +244,7 @@ class IndicesClient(NamespacedClient):
248
244
  )
249
245
 
250
246
  @_rewrite_parameters()
251
- @_stability_warning(Stability.EXPERIMENTAL)
247
+ @_availability_warning(Stability.EXPERIMENTAL)
252
248
  def cancel_migrate_reindex(
253
249
  self,
254
250
  *,
@@ -774,7 +770,7 @@ class IndicesClient(NamespacedClient):
774
770
  @_rewrite_parameters(
775
771
  body_name="create_from",
776
772
  )
777
- @_stability_warning(Stability.EXPERIMENTAL)
773
+ @_availability_warning(Stability.EXPERIMENTAL)
778
774
  def create_from(
779
775
  self,
780
776
  *,
@@ -804,11 +800,7 @@ class IndicesClient(NamespacedClient):
804
800
  raise ValueError("Empty value passed for parameter 'source'")
805
801
  if dest in SKIP_IN_PATH:
806
802
  raise ValueError("Empty value passed for parameter 'dest'")
807
- if create_from is None and body is None:
808
- raise ValueError(
809
- "Empty value passed for parameters 'create_from' and 'body', one of them should be set."
810
- )
811
- elif create_from is not None and body is not None:
803
+ if create_from is not None and body is not None:
812
804
  raise ValueError("Cannot set both 'create_from' and 'body'")
813
805
  __path_parts: t.Dict[str, str] = {
814
806
  "source": _quote(source),
@@ -825,7 +817,11 @@ class IndicesClient(NamespacedClient):
825
817
  if pretty is not None:
826
818
  __query["pretty"] = pretty
827
819
  __body = create_from if create_from is not None else body
828
- __headers = {"accept": "application/json", "content-type": "application/json"}
820
+ if not __body:
821
+ __body = None
822
+ __headers = {"accept": "application/json"}
823
+ if __body is not None:
824
+ __headers["content-type"] = "application/json"
829
825
  return self.perform_request( # type: ignore[return-value]
830
826
  "PUT",
831
827
  __path,
@@ -1075,11 +1071,11 @@ class IndicesClient(NamespacedClient):
1075
1071
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/data-streams-delete-lifecycle.html>`_
1076
1072
 
1077
1073
  :param name: A comma-separated list of data streams of which the data stream
1078
- lifecycle will be deleted; use `*` to get all data streams
1074
+ lifecycle will be deleted. Use `*` to get all data streams
1079
1075
  :param expand_wildcards: Whether wildcard expressions should get expanded to
1080
1076
  open or closed indices (default: open)
1081
- :param master_timeout: Specify timeout for connection to master
1082
- :param timeout: Explicit timestamp for the document
1077
+ :param master_timeout: The period to wait for a connection to the master node.
1078
+ :param timeout: The period to wait for a response.
1083
1079
  """
1084
1080
  if name in SKIP_IN_PATH:
1085
1081
  raise ValueError("Empty value passed for parameter 'name'")
@@ -1173,6 +1169,71 @@ class IndicesClient(NamespacedClient):
1173
1169
  path_parts=__path_parts,
1174
1170
  )
1175
1171
 
1172
+ @_rewrite_parameters()
1173
+ def delete_data_stream_options(
1174
+ self,
1175
+ *,
1176
+ name: t.Union[str, t.Sequence[str]],
1177
+ error_trace: t.Optional[bool] = None,
1178
+ expand_wildcards: t.Optional[
1179
+ t.Union[
1180
+ t.Sequence[
1181
+ t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]]
1182
+ ],
1183
+ t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]],
1184
+ ]
1185
+ ] = None,
1186
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1187
+ human: t.Optional[bool] = None,
1188
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1189
+ pretty: t.Optional[bool] = None,
1190
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1191
+ ) -> ObjectApiResponse[t.Any]:
1192
+ """
1193
+ .. raw:: html
1194
+
1195
+ <p>Delete data stream options.</p>
1196
+ <p>Removes the data stream options from a data stream.</p>
1197
+
1198
+
1199
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-delete-data-stream-options>`_
1200
+
1201
+ :param name: A comma-separated list of data streams of which the data stream
1202
+ options will be deleted. Use `*` to get all data streams
1203
+ :param expand_wildcards: Whether wildcard expressions should get expanded to
1204
+ open or closed indices
1205
+ :param master_timeout: The period to wait for a connection to the master node.
1206
+ :param timeout: The period to wait for a response.
1207
+ """
1208
+ if name in SKIP_IN_PATH:
1209
+ raise ValueError("Empty value passed for parameter 'name'")
1210
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
1211
+ __path = f'/_data_stream/{__path_parts["name"]}/_options'
1212
+ __query: t.Dict[str, t.Any] = {}
1213
+ if error_trace is not None:
1214
+ __query["error_trace"] = error_trace
1215
+ if expand_wildcards is not None:
1216
+ __query["expand_wildcards"] = expand_wildcards
1217
+ if filter_path is not None:
1218
+ __query["filter_path"] = filter_path
1219
+ if human is not None:
1220
+ __query["human"] = human
1221
+ if master_timeout is not None:
1222
+ __query["master_timeout"] = master_timeout
1223
+ if pretty is not None:
1224
+ __query["pretty"] = pretty
1225
+ if timeout is not None:
1226
+ __query["timeout"] = timeout
1227
+ __headers = {"accept": "application/json"}
1228
+ return self.perform_request( # type: ignore[return-value]
1229
+ "DELETE",
1230
+ __path,
1231
+ params=__query,
1232
+ headers=__headers,
1233
+ endpoint_id="indices.delete_data_stream_options",
1234
+ path_parts=__path_parts,
1235
+ )
1236
+
1176
1237
  @_rewrite_parameters()
1177
1238
  def delete_index_template(
1178
1239
  self,
@@ -1288,7 +1349,7 @@ class IndicesClient(NamespacedClient):
1288
1349
  )
1289
1350
 
1290
1351
  @_rewrite_parameters()
1291
- @_stability_warning(Stability.EXPERIMENTAL)
1352
+ @_availability_warning(Stability.EXPERIMENTAL)
1292
1353
  def disk_usage(
1293
1354
  self,
1294
1355
  *,
@@ -1380,7 +1441,7 @@ class IndicesClient(NamespacedClient):
1380
1441
  @_rewrite_parameters(
1381
1442
  body_name="config",
1382
1443
  )
1383
- @_stability_warning(Stability.EXPERIMENTAL)
1444
+ @_availability_warning(Stability.EXPERIMENTAL)
1384
1445
  def downsample(
1385
1446
  self,
1386
1447
  *,
@@ -1758,10 +1819,10 @@ class IndicesClient(NamespacedClient):
1758
1819
 
1759
1820
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/data-streams-explain-lifecycle.html>`_
1760
1821
 
1761
- :param index: The name of the index to explain
1762
- :param include_defaults: indicates if the API should return the default values
1822
+ :param index: Comma-separated list of index names to explain
1823
+ :param include_defaults: Indicates if the API should return the default values
1763
1824
  the system uses for the index's lifecycle
1764
- :param master_timeout: Specify timeout for connection to master
1825
+ :param master_timeout: The period to wait for a connection to the master node.
1765
1826
  """
1766
1827
  if index in SKIP_IN_PATH:
1767
1828
  raise ValueError("Empty value passed for parameter 'index'")
@@ -1791,7 +1852,7 @@ class IndicesClient(NamespacedClient):
1791
1852
  )
1792
1853
 
1793
1854
  @_rewrite_parameters()
1794
- @_stability_warning(Stability.EXPERIMENTAL)
1855
+ @_availability_warning(Stability.EXPERIMENTAL)
1795
1856
  def field_usage_stats(
1796
1857
  self,
1797
1858
  *,
@@ -2043,15 +2104,15 @@ class IndicesClient(NamespacedClient):
2043
2104
  :param expand_wildcards: Whether to expand wildcard expression to concrete indices
2044
2105
  that are open, closed or both.
2045
2106
  :param flush: Specify whether the index should be flushed after performing the
2046
- operation (default: true)
2107
+ operation
2047
2108
  :param ignore_unavailable: Whether specified concrete indices should be ignored
2048
2109
  when unavailable (missing or closed)
2049
2110
  :param max_num_segments: The number of segments the index should be merged into
2050
- (default: dynamic)
2111
+ (defayult: dynamic)
2051
2112
  :param only_expunge_deletes: Specify whether the operation should only expunge
2052
2113
  deleted documents
2053
2114
  :param wait_for_completion: Should the request wait until the force merge is
2054
- completed.
2115
+ completed
2055
2116
  """
2056
2117
  __path_parts: t.Dict[str, str]
2057
2118
  if index not in SKIP_IN_PATH:
@@ -2467,6 +2528,122 @@ class IndicesClient(NamespacedClient):
2467
2528
  path_parts=__path_parts,
2468
2529
  )
2469
2530
 
2531
+ @_rewrite_parameters()
2532
+ def get_data_stream_options(
2533
+ self,
2534
+ *,
2535
+ name: t.Union[str, t.Sequence[str]],
2536
+ error_trace: t.Optional[bool] = None,
2537
+ expand_wildcards: t.Optional[
2538
+ t.Union[
2539
+ t.Sequence[
2540
+ t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]]
2541
+ ],
2542
+ t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]],
2543
+ ]
2544
+ ] = None,
2545
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2546
+ human: t.Optional[bool] = None,
2547
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2548
+ pretty: t.Optional[bool] = None,
2549
+ ) -> ObjectApiResponse[t.Any]:
2550
+ """
2551
+ .. raw:: html
2552
+
2553
+ <p>Get data stream options.</p>
2554
+ <p>Get the data stream options configuration of one or more data streams.</p>
2555
+
2556
+
2557
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-get-data-stream-options>`_
2558
+
2559
+ :param name: Comma-separated list of data streams to limit the request. Supports
2560
+ wildcards (`*`). To target all data streams, omit this parameter or use `*`
2561
+ or `_all`.
2562
+ :param expand_wildcards: Type of data stream that wildcard patterns can match.
2563
+ Supports comma-separated values, such as `open,hidden`. Valid values are:
2564
+ `all`, `open`, `closed`, `hidden`, `none`.
2565
+ :param master_timeout: Period to wait for a connection to the master node. If
2566
+ no response is received before the timeout expires, the request fails and
2567
+ returns an error.
2568
+ """
2569
+ if name in SKIP_IN_PATH:
2570
+ raise ValueError("Empty value passed for parameter 'name'")
2571
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
2572
+ __path = f'/_data_stream/{__path_parts["name"]}/_options'
2573
+ __query: t.Dict[str, t.Any] = {}
2574
+ if error_trace is not None:
2575
+ __query["error_trace"] = error_trace
2576
+ if expand_wildcards is not None:
2577
+ __query["expand_wildcards"] = expand_wildcards
2578
+ if filter_path is not None:
2579
+ __query["filter_path"] = filter_path
2580
+ if human is not None:
2581
+ __query["human"] = human
2582
+ if master_timeout is not None:
2583
+ __query["master_timeout"] = master_timeout
2584
+ if pretty is not None:
2585
+ __query["pretty"] = pretty
2586
+ __headers = {"accept": "application/json"}
2587
+ return self.perform_request( # type: ignore[return-value]
2588
+ "GET",
2589
+ __path,
2590
+ params=__query,
2591
+ headers=__headers,
2592
+ endpoint_id="indices.get_data_stream_options",
2593
+ path_parts=__path_parts,
2594
+ )
2595
+
2596
+ @_rewrite_parameters()
2597
+ def get_data_stream_settings(
2598
+ self,
2599
+ *,
2600
+ name: t.Union[str, t.Sequence[str]],
2601
+ error_trace: t.Optional[bool] = None,
2602
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2603
+ human: t.Optional[bool] = None,
2604
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2605
+ pretty: t.Optional[bool] = None,
2606
+ ) -> ObjectApiResponse[t.Any]:
2607
+ """
2608
+ .. raw:: html
2609
+
2610
+ <p>Get data stream settings.</p>
2611
+ <p>Get setting information for one or more data streams.</p>
2612
+
2613
+
2614
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-get-data-stream-settings.html>`_
2615
+
2616
+ :param name: A comma-separated list of data streams or data stream patterns.
2617
+ Supports wildcards (`*`).
2618
+ :param master_timeout: The period to wait for a connection to the master node.
2619
+ If no response is received before the timeout expires, the request fails
2620
+ and returns an error.
2621
+ """
2622
+ if name in SKIP_IN_PATH:
2623
+ raise ValueError("Empty value passed for parameter 'name'")
2624
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
2625
+ __path = f'/_data_stream/{__path_parts["name"]}/_settings'
2626
+ __query: t.Dict[str, t.Any] = {}
2627
+ if error_trace is not None:
2628
+ __query["error_trace"] = error_trace
2629
+ if filter_path is not None:
2630
+ __query["filter_path"] = filter_path
2631
+ if human is not None:
2632
+ __query["human"] = human
2633
+ if master_timeout is not None:
2634
+ __query["master_timeout"] = master_timeout
2635
+ if pretty is not None:
2636
+ __query["pretty"] = pretty
2637
+ __headers = {"accept": "application/json"}
2638
+ return self.perform_request( # type: ignore[return-value]
2639
+ "GET",
2640
+ __path,
2641
+ params=__query,
2642
+ headers=__headers,
2643
+ endpoint_id="indices.get_data_stream_settings",
2644
+ path_parts=__path_parts,
2645
+ )
2646
+
2470
2647
  @_rewrite_parameters()
2471
2648
  def get_field_mapping(
2472
2649
  self,
@@ -2582,8 +2759,8 @@ class IndicesClient(NamespacedClient):
2582
2759
 
2583
2760
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-get-template.html>`_
2584
2761
 
2585
- :param name: Comma-separated list of index template names used to limit the request.
2586
- Wildcard (*) expressions are supported.
2762
+ :param name: Name of index template to retrieve. Wildcard (*) expressions are
2763
+ supported.
2587
2764
  :param flat_settings: If true, returns settings in flat format.
2588
2765
  :param include_defaults: If true, returns all relevant default configurations
2589
2766
  for the index template.
@@ -2714,7 +2891,7 @@ class IndicesClient(NamespacedClient):
2714
2891
  )
2715
2892
 
2716
2893
  @_rewrite_parameters()
2717
- @_stability_warning(Stability.EXPERIMENTAL)
2894
+ @_availability_warning(Stability.EXPERIMENTAL)
2718
2895
  def get_migrate_reindex_status(
2719
2896
  self,
2720
2897
  *,
@@ -2930,7 +3107,7 @@ class IndicesClient(NamespacedClient):
2930
3107
  @_rewrite_parameters(
2931
3108
  body_name="reindex",
2932
3109
  )
2933
- @_stability_warning(Stability.EXPERIMENTAL)
3110
+ @_availability_warning(Stability.EXPERIMENTAL)
2934
3111
  def migrate_reindex(
2935
3112
  self,
2936
3113
  *,
@@ -3234,7 +3411,7 @@ class IndicesClient(NamespacedClient):
3234
3411
 
3235
3412
  `<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-promote-data-stream>`_
3236
3413
 
3237
- :param name: The name of the data stream
3414
+ :param name: The name of the data stream to promote
3238
3415
  :param master_timeout: Period to wait for a connection to the master node. If
3239
3416
  no response is received before the timeout expires, the request fails and
3240
3417
  returns an error.
@@ -3380,7 +3557,7 @@ class IndicesClient(NamespacedClient):
3380
3557
  *,
3381
3558
  name: t.Union[str, t.Sequence[str]],
3382
3559
  data_retention: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3383
- downsampling: t.Optional[t.Mapping[str, t.Any]] = None,
3560
+ downsampling: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
3384
3561
  enabled: t.Optional[bool] = None,
3385
3562
  error_trace: t.Optional[bool] = None,
3386
3563
  expand_wildcards: t.Optional[
@@ -3453,11 +3630,7 @@ class IndicesClient(NamespacedClient):
3453
3630
  __body["downsampling"] = downsampling
3454
3631
  if enabled is not None:
3455
3632
  __body["enabled"] = enabled
3456
- if not __body:
3457
- __body = None # type: ignore[assignment]
3458
- __headers = {"accept": "application/json"}
3459
- if __body is not None:
3460
- __headers["content-type"] = "application/json"
3633
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3461
3634
  return self.perform_request( # type: ignore[return-value]
3462
3635
  "PUT",
3463
3636
  __path,
@@ -3468,6 +3641,164 @@ class IndicesClient(NamespacedClient):
3468
3641
  path_parts=__path_parts,
3469
3642
  )
3470
3643
 
3644
+ @_rewrite_parameters(
3645
+ body_fields=("failure_store",),
3646
+ )
3647
+ def put_data_stream_options(
3648
+ self,
3649
+ *,
3650
+ name: t.Union[str, t.Sequence[str]],
3651
+ error_trace: t.Optional[bool] = None,
3652
+ expand_wildcards: t.Optional[
3653
+ t.Union[
3654
+ t.Sequence[
3655
+ t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]]
3656
+ ],
3657
+ t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]],
3658
+ ]
3659
+ ] = None,
3660
+ failure_store: t.Optional[t.Mapping[str, t.Any]] = None,
3661
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3662
+ human: t.Optional[bool] = None,
3663
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3664
+ pretty: t.Optional[bool] = None,
3665
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3666
+ body: t.Optional[t.Dict[str, t.Any]] = None,
3667
+ ) -> ObjectApiResponse[t.Any]:
3668
+ """
3669
+ .. raw:: html
3670
+
3671
+ <p>Update data stream options.</p>
3672
+ <p>Update the data stream options of the specified data streams.</p>
3673
+
3674
+
3675
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-indices-update-data-stream-options>`_
3676
+
3677
+ :param name: Comma-separated list of data streams used to limit the request.
3678
+ Supports wildcards (`*`). To target all data streams use `*` or `_all`.
3679
+ :param expand_wildcards: Type of data stream that wildcard patterns can match.
3680
+ Supports comma-separated values, such as `open,hidden`. Valid values are:
3681
+ `all`, `hidden`, `open`, `closed`, `none`.
3682
+ :param failure_store: If defined, it will update the failure store configuration
3683
+ of every data stream resolved by the name expression.
3684
+ :param master_timeout: Period to wait for a connection to the master node. If
3685
+ no response is received before the timeout expires, the request fails and
3686
+ returns an error.
3687
+ :param timeout: Period to wait for a response. If no response is received before
3688
+ the timeout expires, the request fails and returns an error.
3689
+ """
3690
+ if name in SKIP_IN_PATH:
3691
+ raise ValueError("Empty value passed for parameter 'name'")
3692
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
3693
+ __path = f'/_data_stream/{__path_parts["name"]}/_options'
3694
+ __query: t.Dict[str, t.Any] = {}
3695
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
3696
+ if error_trace is not None:
3697
+ __query["error_trace"] = error_trace
3698
+ if expand_wildcards is not None:
3699
+ __query["expand_wildcards"] = expand_wildcards
3700
+ if filter_path is not None:
3701
+ __query["filter_path"] = filter_path
3702
+ if human is not None:
3703
+ __query["human"] = human
3704
+ if master_timeout is not None:
3705
+ __query["master_timeout"] = master_timeout
3706
+ if pretty is not None:
3707
+ __query["pretty"] = pretty
3708
+ if timeout is not None:
3709
+ __query["timeout"] = timeout
3710
+ if not __body:
3711
+ if failure_store is not None:
3712
+ __body["failure_store"] = failure_store
3713
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3714
+ return self.perform_request( # type: ignore[return-value]
3715
+ "PUT",
3716
+ __path,
3717
+ params=__query,
3718
+ headers=__headers,
3719
+ body=__body,
3720
+ endpoint_id="indices.put_data_stream_options",
3721
+ path_parts=__path_parts,
3722
+ )
3723
+
3724
+ @_rewrite_parameters(
3725
+ body_name="settings",
3726
+ )
3727
+ def put_data_stream_settings(
3728
+ self,
3729
+ *,
3730
+ name: t.Union[str, t.Sequence[str]],
3731
+ settings: t.Optional[t.Mapping[str, t.Any]] = None,
3732
+ body: t.Optional[t.Mapping[str, t.Any]] = None,
3733
+ dry_run: t.Optional[bool] = None,
3734
+ error_trace: t.Optional[bool] = None,
3735
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3736
+ human: t.Optional[bool] = None,
3737
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3738
+ pretty: t.Optional[bool] = None,
3739
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3740
+ ) -> ObjectApiResponse[t.Any]:
3741
+ """
3742
+ .. raw:: html
3743
+
3744
+ <p>Update data stream settings.</p>
3745
+ <p>This API can be used to override settings on specific data streams. These overrides will take precedence over what
3746
+ is specified in the template that the data stream matches. To prevent your data stream from getting into an invalid state,
3747
+ only certain settings are allowed. If possible, the setting change is applied to all
3748
+ backing indices. Otherwise, it will be applied when the data stream is next rolled over.</p>
3749
+
3750
+
3751
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-put-data-stream-settings.html>`_
3752
+
3753
+ :param name: A comma-separated list of data streams or data stream patterns.
3754
+ :param settings:
3755
+ :param dry_run: If `true`, the request does not actually change the settings
3756
+ on any data streams or indices. Instead, it simulates changing the settings
3757
+ and reports back to the user what would have happened had these settings
3758
+ actually been applied.
3759
+ :param master_timeout: The period to wait for a connection to the master node.
3760
+ If no response is received before the timeout expires, the request fails
3761
+ and returns an error.
3762
+ :param timeout: The period to wait for a response. If no response is received
3763
+ before the timeout expires, the request fails and returns an error.
3764
+ """
3765
+ if name in SKIP_IN_PATH:
3766
+ raise ValueError("Empty value passed for parameter 'name'")
3767
+ if settings is None and body is None:
3768
+ raise ValueError(
3769
+ "Empty value passed for parameters 'settings' and 'body', one of them should be set."
3770
+ )
3771
+ elif settings is not None and body is not None:
3772
+ raise ValueError("Cannot set both 'settings' and 'body'")
3773
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
3774
+ __path = f'/_data_stream/{__path_parts["name"]}/_settings'
3775
+ __query: t.Dict[str, t.Any] = {}
3776
+ if dry_run is not None:
3777
+ __query["dry_run"] = dry_run
3778
+ if error_trace is not None:
3779
+ __query["error_trace"] = error_trace
3780
+ if filter_path is not None:
3781
+ __query["filter_path"] = filter_path
3782
+ if human is not None:
3783
+ __query["human"] = human
3784
+ if master_timeout is not None:
3785
+ __query["master_timeout"] = master_timeout
3786
+ if pretty is not None:
3787
+ __query["pretty"] = pretty
3788
+ if timeout is not None:
3789
+ __query["timeout"] = timeout
3790
+ __body = settings if settings is not None else body
3791
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3792
+ return self.perform_request( # type: ignore[return-value]
3793
+ "PUT",
3794
+ __path,
3795
+ params=__query,
3796
+ headers=__headers,
3797
+ body=__body,
3798
+ endpoint_id="indices.put_data_stream_settings",
3799
+ path_parts=__path_parts,
3800
+ )
3801
+
3471
3802
  @_rewrite_parameters(
3472
3803
  body_fields=(
3473
3804
  "allow_auto_create",
@@ -3541,7 +3872,7 @@ class IndicesClient(NamespacedClient):
3541
3872
  via `actions.auto_create_index`. If set to `false`, then indices or data
3542
3873
  streams matching the template must always be explicitly created, and may
3543
3874
  never be automatically created.
3544
- :param cause: User defined reason for creating/updating the index template
3875
+ :param cause: User defined reason for creating or updating the index template
3545
3876
  :param composed_of: An ordered list of component template names. Component templates
3546
3877
  are merged in the order specified, meaning that the last component template
3547
3878
  specified has the highest precedence.
@@ -3718,7 +4049,7 @@ class IndicesClient(NamespacedClient):
3718
4049
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-put-mapping.html>`_
3719
4050
 
3720
4051
  :param index: A comma-separated list of index names the mapping should be added
3721
- to (supports wildcards); use `_all` or omit to add the mapping on all indices.
4052
+ to (supports wildcards). Use `_all` or omit to add the mapping on all indices.
3722
4053
  :param allow_no_indices: If `false`, the request returns an error if any wildcard
3723
4054
  expression, index alias, or `_all` value targets only missing or closed indices.
3724
4055
  This behavior applies even if the request targets other open indices.
@@ -4017,7 +4348,7 @@ class IndicesClient(NamespacedClient):
4017
4348
 
4018
4349
  :param name: The name of the template
4019
4350
  :param aliases: Aliases for the index.
4020
- :param cause: User defined reason for creating/updating the index template
4351
+ :param cause: User defined reason for creating or updating the index template
4021
4352
  :param create: If true, this request cannot replace or update existing index
4022
4353
  templates.
4023
4354
  :param index_patterns: Array of wildcard expressions used to match the names
@@ -4207,6 +4538,7 @@ class IndicesClient(NamespacedClient):
4207
4538
  For data streams, the API runs the refresh operation on the stream’s backing indices.</p>
4208
4539
  <p>By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds.
4209
4540
  You can change this default interval with the <code>index.refresh_interval</code> setting.</p>
4541
+ <p>In Elastic Cloud Serverless, the default refresh interval is 5 seconds across all indices.</p>
4210
4542
  <p>Refresh requests are synchronous and do not return a response until the refresh operation completes.</p>
4211
4543
  <p>Refreshes are resource-intensive.
4212
4544
  To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.</p>
@@ -4962,11 +5294,7 @@ class IndicesClient(NamespacedClient):
4962
5294
  __body["aliases"] = aliases
4963
5295
  if settings is not None:
4964
5296
  __body["settings"] = settings
4965
- if not __body:
4966
- __body = None # type: ignore[assignment]
4967
- __headers = {"accept": "application/json"}
4968
- if __body is not None:
4969
- __headers["content-type"] = "application/json"
5297
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4970
5298
  return self.perform_request( # type: ignore[return-value]
4971
5299
  "PUT",
4972
5300
  __path,
@@ -4977,7 +5305,9 @@ class IndicesClient(NamespacedClient):
4977
5305
  path_parts=__path_parts,
4978
5306
  )
4979
5307
 
4980
- @_rewrite_parameters()
5308
+ @_rewrite_parameters(
5309
+ body_name="index_template",
5310
+ )
4981
5311
  def simulate_index_template(
4982
5312
  self,
4983
5313
  *,
@@ -4988,6 +5318,8 @@ class IndicesClient(NamespacedClient):
4988
5318
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4989
5319
  human: t.Optional[bool] = None,
4990
5320
  include_defaults: t.Optional[bool] = None,
5321
+ index_template: t.Optional[t.Mapping[str, t.Any]] = None,
5322
+ body: t.Optional[t.Mapping[str, t.Any]] = None,
4991
5323
  master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4992
5324
  pretty: t.Optional[bool] = None,
4993
5325
  ) -> ObjectApiResponse[t.Any]:
@@ -5007,12 +5339,15 @@ class IndicesClient(NamespacedClient):
5007
5339
  only be dry-run added if new or can also replace an existing one
5008
5340
  :param include_defaults: If true, returns all relevant default configurations
5009
5341
  for the index template.
5342
+ :param index_template:
5010
5343
  :param master_timeout: Period to wait for a connection to the master node. If
5011
5344
  no response is received before the timeout expires, the request fails and
5012
5345
  returns an error.
5013
5346
  """
5014
5347
  if name in SKIP_IN_PATH:
5015
5348
  raise ValueError("Empty value passed for parameter 'name'")
5349
+ if index_template is not None and body is not None:
5350
+ raise ValueError("Cannot set both 'index_template' and 'body'")
5016
5351
  __path_parts: t.Dict[str, str] = {"name": _quote(name)}
5017
5352
  __path = f'/_index_template/_simulate_index/{__path_parts["name"]}'
5018
5353
  __query: t.Dict[str, t.Any] = {}
@@ -5032,12 +5367,18 @@ class IndicesClient(NamespacedClient):
5032
5367
  __query["master_timeout"] = master_timeout
5033
5368
  if pretty is not None:
5034
5369
  __query["pretty"] = pretty
5370
+ __body = index_template if index_template is not None else body
5371
+ if not __body:
5372
+ __body = None
5035
5373
  __headers = {"accept": "application/json"}
5374
+ if __body is not None:
5375
+ __headers["content-type"] = "application/json"
5036
5376
  return self.perform_request( # type: ignore[return-value]
5037
5377
  "POST",
5038
5378
  __path,
5039
5379
  params=__query,
5040
5380
  headers=__headers,
5381
+ body=__body,
5041
5382
  endpoint_id="indices.simulate_index_template",
5042
5383
  path_parts=__path_parts,
5043
5384
  )
@@ -5305,11 +5646,7 @@ class IndicesClient(NamespacedClient):
5305
5646
  __body["aliases"] = aliases
5306
5647
  if settings is not None:
5307
5648
  __body["settings"] = settings
5308
- if not __body:
5309
- __body = None # type: ignore[assignment]
5310
- __headers = {"accept": "application/json"}
5311
- if __body is not None:
5312
- __headers["content-type"] = "application/json"
5649
+ __headers = {"accept": "application/json", "content-type": "application/json"}
5313
5650
  return self.perform_request( # type: ignore[return-value]
5314
5651
  "PUT",
5315
5652
  __path,
@@ -5366,7 +5703,7 @@ class IndicesClient(NamespacedClient):
5366
5703
 
5367
5704
  :param index: A comma-separated list of index names; use `_all` or empty string
5368
5705
  to perform the operation on all indices
5369
- :param metric: Limit the information returned the specific metrics.
5706
+ :param metric: Limit the information returned the specific metrics
5370
5707
  :param completion_fields: Comma-separated list or wildcard expressions of fields
5371
5708
  to include in fielddata and suggest statistics.
5372
5709
  :param expand_wildcards: Type of index that wildcard patterns can match. If the
@@ -5386,8 +5723,8 @@ class IndicesClient(NamespacedClient):
5386
5723
  are requested).
5387
5724
  :param include_unloaded_segments: If true, the response includes information
5388
5725
  from segments that are not loaded into memory.
5389
- :param level: Indicates whether statistics are aggregated at the cluster, index,
5390
- or shard level.
5726
+ :param level: Indicates whether statistics are aggregated at the cluster, indices,
5727
+ or shards level.
5391
5728
  """
5392
5729
  __path_parts: t.Dict[str, str]
5393
5730
  if index not in SKIP_IN_PATH and metric not in SKIP_IN_PATH:
@@ -5639,8 +5976,8 @@ class IndicesClient(NamespacedClient):
5639
5976
  :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed.
5640
5977
  :param analyzer: Analyzer to use for the query string. This parameter can only
5641
5978
  be used when the `q` query string parameter is specified.
5642
- :param default_operator: The default operator for query string query: `AND` or
5643
- `OR`.
5979
+ :param default_operator: The default operator for query string query: `and` or
5980
+ `or`.
5644
5981
  :param df: Field to use as default where no field prefix is given in the query
5645
5982
  string. This parameter can only be used when the `q` query string parameter
5646
5983
  is specified.