elasticsearch 9.1.1__py3-none-any.whl → 9.2.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 (76) hide show
  1. elasticsearch/_async/client/__init__.py +96 -44
  2. elasticsearch/_async/client/async_search.py +7 -0
  3. elasticsearch/_async/client/cat.py +489 -26
  4. elasticsearch/_async/client/cluster.py +9 -8
  5. elasticsearch/_async/client/connector.py +3 -3
  6. elasticsearch/_async/client/eql.py +7 -0
  7. elasticsearch/_async/client/esql.py +26 -3
  8. elasticsearch/_async/client/fleet.py +1 -5
  9. elasticsearch/_async/client/graph.py +1 -5
  10. elasticsearch/_async/client/ilm.py +2 -10
  11. elasticsearch/_async/client/indices.py +181 -37
  12. elasticsearch/_async/client/inference.py +291 -124
  13. elasticsearch/_async/client/ingest.py +8 -0
  14. elasticsearch/_async/client/license.py +4 -2
  15. elasticsearch/_async/client/logstash.py +3 -1
  16. elasticsearch/_async/client/ml.py +2 -2
  17. elasticsearch/_async/client/nodes.py +3 -5
  18. elasticsearch/_async/client/project.py +67 -0
  19. elasticsearch/_async/client/security.py +39 -0
  20. elasticsearch/_async/client/shutdown.py +5 -15
  21. elasticsearch/_async/client/simulate.py +8 -0
  22. elasticsearch/_async/client/slm.py +1 -5
  23. elasticsearch/_async/client/snapshot.py +20 -10
  24. elasticsearch/_async/client/sql.py +7 -0
  25. elasticsearch/_async/client/streams.py +185 -0
  26. elasticsearch/_async/client/watcher.py +1 -5
  27. elasticsearch/_async/helpers.py +74 -12
  28. elasticsearch/_sync/client/__init__.py +96 -44
  29. elasticsearch/_sync/client/async_search.py +7 -0
  30. elasticsearch/_sync/client/cat.py +489 -26
  31. elasticsearch/_sync/client/cluster.py +9 -8
  32. elasticsearch/_sync/client/connector.py +3 -3
  33. elasticsearch/_sync/client/eql.py +7 -0
  34. elasticsearch/_sync/client/esql.py +26 -3
  35. elasticsearch/_sync/client/fleet.py +1 -5
  36. elasticsearch/_sync/client/graph.py +1 -5
  37. elasticsearch/_sync/client/ilm.py +2 -10
  38. elasticsearch/_sync/client/indices.py +181 -37
  39. elasticsearch/_sync/client/inference.py +291 -124
  40. elasticsearch/_sync/client/ingest.py +8 -0
  41. elasticsearch/_sync/client/license.py +4 -2
  42. elasticsearch/_sync/client/logstash.py +3 -1
  43. elasticsearch/_sync/client/ml.py +2 -2
  44. elasticsearch/_sync/client/nodes.py +3 -5
  45. elasticsearch/_sync/client/project.py +67 -0
  46. elasticsearch/_sync/client/security.py +39 -0
  47. elasticsearch/_sync/client/shutdown.py +5 -15
  48. elasticsearch/_sync/client/simulate.py +8 -0
  49. elasticsearch/_sync/client/slm.py +1 -5
  50. elasticsearch/_sync/client/snapshot.py +20 -10
  51. elasticsearch/_sync/client/sql.py +7 -0
  52. elasticsearch/_sync/client/streams.py +185 -0
  53. elasticsearch/_sync/client/watcher.py +1 -5
  54. elasticsearch/_version.py +2 -1
  55. elasticsearch/client.py +4 -0
  56. elasticsearch/compat.py +30 -1
  57. elasticsearch/dsl/__init__.py +28 -0
  58. elasticsearch/dsl/_async/document.py +2 -1
  59. elasticsearch/dsl/_sync/document.py +2 -1
  60. elasticsearch/dsl/aggs.py +97 -0
  61. elasticsearch/dsl/document_base.py +53 -13
  62. elasticsearch/dsl/field.py +21 -2
  63. elasticsearch/dsl/pydantic.py +152 -0
  64. elasticsearch/dsl/query.py +5 -1
  65. elasticsearch/dsl/response/__init__.py +3 -0
  66. elasticsearch/dsl/search_base.py +5 -1
  67. elasticsearch/dsl/types.py +226 -14
  68. elasticsearch/esql/esql.py +331 -41
  69. elasticsearch/esql/functions.py +88 -0
  70. elasticsearch/helpers/__init__.py +10 -1
  71. elasticsearch/helpers/actions.py +106 -33
  72. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/METADATA +27 -5
  73. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/RECORD +76 -71
  74. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/WHEEL +0 -0
  75. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/licenses/LICENSE +0 -0
  76. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/licenses/NOTICE +0 -0
@@ -49,6 +49,7 @@ class ClusterClient(NamespacedClient):
49
49
 
50
50
  <p>Explain the shard allocations.
51
51
  Get explanations for shard allocations in the cluster.
52
+ This API accepts the current_node, index, primary and shard parameters in the request body or in query parameters, but not in both at the same time.
52
53
  For unassigned shards, it provides an explanation for why the shard is unassigned.
53
54
  For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node.
54
55
  This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.
@@ -57,17 +58,16 @@ class ClusterClient(NamespacedClient):
57
58
 
58
59
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-allocation-explain>`_
59
60
 
60
- :param current_node: Specifies the node ID or the name of the node to only explain
61
- a shard that is currently located on the specified node.
61
+ :param current_node: Explain a shard only if it is currently located on the specified
62
+ node name or node ID.
62
63
  :param include_disk_info: If true, returns information about disk usage and shard
63
64
  sizes.
64
65
  :param include_yes_decisions: If true, returns YES decisions in explanation.
65
- :param index: Specifies the name of the index that you would like an explanation
66
- for.
66
+ :param index: The name of the index that you would like an explanation for.
67
67
  :param master_timeout: Period to wait for a connection to the master node.
68
- :param primary: If true, returns explanation for the primary shard for the given
69
- shard ID.
70
- :param shard: Specifies the ID of the shard that you would like an explanation
68
+ :param primary: If true, returns an explanation for the primary shard for the
69
+ specified shard ID.
70
+ :param shard: An identifier for the shard that you would like an explanation
71
71
  for.
72
72
  """
73
73
  __path_parts: t.Dict[str, str] = {}
@@ -1124,7 +1124,8 @@ class ClusterClient(NamespacedClient):
1124
1124
  when unavailable (missing or closed)
1125
1125
  :param local: Return local information, do not retrieve the state from master
1126
1126
  node (default: false)
1127
- :param master_timeout: Specify timeout for connection to master
1127
+ :param master_timeout: Timeout for waiting for new cluster state in case it is
1128
+ blocked
1128
1129
  :param wait_for_metadata_version: Wait for the metadata version to be equal or
1129
1130
  greater than the specified metadata version
1130
1131
  :param wait_for_timeout: The maximum time to wait for wait_for_metadata_version
@@ -103,7 +103,7 @@ class ConnectorClient(NamespacedClient):
103
103
 
104
104
  :param connector_id: The unique identifier of the connector to be deleted
105
105
  :param delete_sync_jobs: A flag indicating if associated sync jobs should be
106
- also removed. Defaults to false.
106
+ also removed.
107
107
  :param hard: A flag indicating if the connector should be hard deleted.
108
108
  """
109
109
  if connector_id in SKIP_IN_PATH:
@@ -360,7 +360,7 @@ class ConnectorClient(NamespacedClient):
360
360
 
361
361
  :param connector_name: A comma-separated list of connector names to fetch connector
362
362
  documents for
363
- :param from_: Starting offset (default: 0)
363
+ :param from_: Starting offset
364
364
  :param include_deleted: A flag to indicate if the desired connector should be
365
365
  fetched, even if it was soft-deleted.
366
366
  :param index_name: A comma-separated list of connector index names to fetch connector
@@ -955,7 +955,7 @@ class ConnectorClient(NamespacedClient):
955
955
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-connector-sync-job-list>`_
956
956
 
957
957
  :param connector_id: A connector id to fetch connector sync jobs for
958
- :param from_: Starting offset (default: 0)
958
+ :param from_: Starting offset
959
959
  :param job_type: A comma-separated list of job types to fetch the sync jobs for
960
960
  :param size: Specifies a max number of results to get
961
961
  :param status: A sync job status to fetch connector sync jobs for
@@ -229,6 +229,7 @@ class EqlClient(NamespacedClient):
229
229
  keep_on_completion: t.Optional[bool] = None,
230
230
  max_samples_per_key: t.Optional[int] = None,
231
231
  pretty: t.Optional[bool] = None,
232
+ project_routing: t.Optional[str] = None,
232
233
  result_position: t.Optional[t.Union[str, t.Literal["head", "tail"]]] = None,
233
234
  runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
234
235
  size: t.Optional[int] = None,
@@ -285,6 +286,10 @@ class EqlClient(NamespacedClient):
285
286
  `size` parameter to get a smaller or larger set of samples. To retrieve more
286
287
  than one sample per set of join keys, use the `max_samples_per_key` parameter.
287
288
  Pipes are not supported for sample queries.
289
+ :param project_routing: Specifies a subset of projects to target for the search
290
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
291
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
292
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
288
293
  :param result_position:
289
294
  :param runtime_mappings:
290
295
  :param size: For basic queries, the maximum number of matching events to return.
@@ -318,6 +323,8 @@ class EqlClient(NamespacedClient):
318
323
  __query["ignore_unavailable"] = ignore_unavailable
319
324
  if pretty is not None:
320
325
  __query["pretty"] = pretty
326
+ if project_routing is not None:
327
+ __query["project_routing"] = project_routing
321
328
  if not __body:
322
329
  if query is not None:
323
330
  __body["query"] = query
@@ -40,6 +40,7 @@ class EsqlClient(NamespacedClient):
40
40
  "columnar",
41
41
  "filter",
42
42
  "include_ccs_metadata",
43
+ "include_execution_metadata",
43
44
  "keep_alive",
44
45
  "keep_on_completion",
45
46
  "locale",
@@ -71,6 +72,7 @@ class EsqlClient(NamespacedClient):
71
72
  ] = None,
72
73
  human: t.Optional[bool] = None,
73
74
  include_ccs_metadata: t.Optional[bool] = None,
75
+ include_execution_metadata: t.Optional[bool] = None,
74
76
  keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
75
77
  keep_on_completion: t.Optional[bool] = None,
76
78
  locale: t.Optional[str] = None,
@@ -120,7 +122,11 @@ class EsqlClient(NamespacedClient):
120
122
  be returned if the async query doesn't finish within the timeout. The query
121
123
  ID and running status are available in the `X-Elasticsearch-Async-Id` and
122
124
  `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively.
123
- :param include_ccs_metadata: When set to `true` and performing a cross-cluster
125
+ :param include_ccs_metadata: When set to `true` and performing a cross-cluster/cross-project
126
+ query, the response will include an extra `_clusters` object with information
127
+ about the clusters that participated in the search along with info such as
128
+ shards count.
129
+ :param include_execution_metadata: When set to `true` and performing a cross-cluster/cross-project
124
130
  query, the response will include an extra `_clusters` object with information
125
131
  about the clusters that participated in the search along with info such as
126
132
  shards count.
@@ -180,6 +186,8 @@ class EsqlClient(NamespacedClient):
180
186
  __body["filter"] = filter
181
187
  if include_ccs_metadata is not None:
182
188
  __body["include_ccs_metadata"] = include_ccs_metadata
189
+ if include_execution_metadata is not None:
190
+ __body["include_execution_metadata"] = include_execution_metadata
183
191
  if keep_alive is not None:
184
192
  __body["keep_alive"] = keep_alive
185
193
  if keep_on_completion is not None:
@@ -486,6 +494,7 @@ class EsqlClient(NamespacedClient):
486
494
  "columnar",
487
495
  "filter",
488
496
  "include_ccs_metadata",
497
+ "include_execution_metadata",
489
498
  "locale",
490
499
  "params",
491
500
  "profile",
@@ -514,8 +523,16 @@ class EsqlClient(NamespacedClient):
514
523
  ] = None,
515
524
  human: t.Optional[bool] = None,
516
525
  include_ccs_metadata: t.Optional[bool] = None,
526
+ include_execution_metadata: t.Optional[bool] = None,
517
527
  locale: t.Optional[str] = None,
518
- params: t.Optional[t.Sequence[t.Union[None, bool, float, int, str]]] = None,
528
+ params: t.Optional[
529
+ t.Sequence[
530
+ t.Union[
531
+ t.Sequence[t.Union[None, bool, float, int, str]],
532
+ t.Union[None, bool, float, int, str],
533
+ ]
534
+ ]
535
+ ] = None,
519
536
  pretty: t.Optional[bool] = None,
520
537
  profile: t.Optional[bool] = None,
521
538
  tables: t.Optional[
@@ -554,7 +571,11 @@ class EsqlClient(NamespacedClient):
554
571
  :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
555
572
  `tsv`, and `txt` formats will return results in a tabular format, excluding
556
573
  other metadata fields from the response.
557
- :param include_ccs_metadata: When set to `true` and performing a cross-cluster
574
+ :param include_ccs_metadata: When set to `true` and performing a cross-cluster/cross-project
575
+ query, the response will include an extra `_clusters` object with information
576
+ about the clusters that participated in the search along with info such as
577
+ shards count.
578
+ :param include_execution_metadata: When set to `true` and performing a cross-cluster/cross-project
558
579
  query, the response will include an extra `_clusters` object with information
559
580
  about the clusters that participated in the search along with info such as
560
581
  shards count.
@@ -600,6 +621,8 @@ class EsqlClient(NamespacedClient):
600
621
  __body["filter"] = filter
601
622
  if include_ccs_metadata is not None:
602
623
  __body["include_ccs_metadata"] = include_ccs_metadata
624
+ if include_execution_metadata is not None:
625
+ __body["include_execution_metadata"] = include_execution_metadata
603
626
  if locale is not None:
604
627
  __body["locale"] = locale
605
628
  if params is not None:
@@ -642,11 +642,7 @@ class FleetClient(NamespacedClient):
642
642
  __body["track_total_hits"] = track_total_hits
643
643
  if version is not None:
644
644
  __body["version"] = version
645
- if not __body:
646
- __body = None # type: ignore[assignment]
647
- __headers = {"accept": "application/json"}
648
- if __body is not None:
649
- __headers["content-type"] = "application/json"
645
+ __headers = {"accept": "application/json", "content-type": "application/json"}
650
646
  return await self.perform_request( # type: ignore[return-value]
651
647
  "POST",
652
648
  __path,
@@ -97,11 +97,7 @@ class GraphClient(NamespacedClient):
97
97
  __body["query"] = query
98
98
  if vertices is not None:
99
99
  __body["vertices"] = vertices
100
- if not __body:
101
- __body = None # type: ignore[assignment]
102
- __headers = {"accept": "application/json"}
103
- if __body is not None:
104
- __headers["content-type"] = "application/json"
100
+ __headers = {"accept": "application/json", "content-type": "application/json"}
105
101
  return await self.perform_request( # type: ignore[return-value]
106
102
  "POST",
107
103
  __path,
@@ -383,11 +383,7 @@ class IlmClient(NamespacedClient):
383
383
  __body["current_step"] = current_step
384
384
  if next_step is not None:
385
385
  __body["next_step"] = next_step
386
- if not __body:
387
- __body = None # type: ignore[assignment]
388
- __headers = {"accept": "application/json"}
389
- if __body is not None:
390
- __headers["content-type"] = "application/json"
386
+ __headers = {"accept": "application/json", "content-type": "application/json"}
391
387
  return await self.perform_request( # type: ignore[return-value]
392
388
  "POST",
393
389
  __path,
@@ -453,11 +449,7 @@ class IlmClient(NamespacedClient):
453
449
  if not __body:
454
450
  if policy is not None:
455
451
  __body["policy"] = policy
456
- if not __body:
457
- __body = None # type: ignore[assignment]
458
- __headers = {"accept": "application/json"}
459
- if __body is not None:
460
- __headers["content-type"] = "application/json"
452
+ __headers = {"accept": "application/json", "content-type": "application/json"}
461
453
  return await self.perform_request( # type: ignore[return-value]
462
454
  "PUT",
463
455
  __path,
@@ -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 await self.perform_request( # type: ignore[return-value]
241
237
  "POST",
242
238
  __path,
@@ -812,11 +808,7 @@ class IndicesClient(NamespacedClient):
812
808
  raise ValueError("Empty value passed for parameter 'source'")
813
809
  if dest in SKIP_IN_PATH:
814
810
  raise ValueError("Empty value passed for parameter 'dest'")
815
- if create_from is None and body is None:
816
- raise ValueError(
817
- "Empty value passed for parameters 'create_from' and 'body', one of them should be set."
818
- )
819
- elif create_from is not None and body is not None:
811
+ if create_from is not None and body is not None:
820
812
  raise ValueError("Cannot set both 'create_from' and 'body'")
821
813
  __path_parts: t.Dict[str, str] = {
822
814
  "source": _quote(source),
@@ -833,7 +825,11 @@ class IndicesClient(NamespacedClient):
833
825
  if pretty is not None:
834
826
  __query["pretty"] = pretty
835
827
  __body = create_from if create_from is not None else body
836
- __headers = {"accept": "application/json", "content-type": "application/json"}
828
+ if not __body:
829
+ __body = None
830
+ __headers = {"accept": "application/json"}
831
+ if __body is not None:
832
+ __headers["content-type"] = "application/json"
837
833
  return await self.perform_request( # type: ignore[return-value]
838
834
  "PUT",
839
835
  __path,
@@ -1393,6 +1389,7 @@ class IndicesClient(NamespacedClient):
1393
1389
  <p>NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index <code>store_size</code> value because some small metadata files are ignored and some parts of data files might not be scanned by the API.
1394
1390
  Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate.
1395
1391
  The stored size of the <code>_id</code> field is likely underestimated while the <code>_source</code> field is overestimated.</p>
1392
+ <p>For usage examples see the External documentation or refer to <a href="https://www.elastic.co/docs/reference/elasticsearch/rest-apis/index-disk-usage">Analyze the index disk usage example</a> for an example.</p>
1396
1393
 
1397
1394
 
1398
1395
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-disk-usage>`_
@@ -2542,6 +2539,57 @@ class IndicesClient(NamespacedClient):
2542
2539
  path_parts=__path_parts,
2543
2540
  )
2544
2541
 
2542
+ @_rewrite_parameters()
2543
+ async def get_data_stream_mappings(
2544
+ self,
2545
+ *,
2546
+ name: t.Union[str, t.Sequence[str]],
2547
+ error_trace: t.Optional[bool] = None,
2548
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2549
+ human: t.Optional[bool] = None,
2550
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2551
+ pretty: t.Optional[bool] = None,
2552
+ ) -> ObjectApiResponse[t.Any]:
2553
+ """
2554
+ .. raw:: html
2555
+
2556
+ <p>Get data stream mappings.</p>
2557
+ <p>Get mapping information for one or more data streams.</p>
2558
+
2559
+
2560
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-mappings>`_
2561
+
2562
+ :param name: A comma-separated list of data streams or data stream patterns.
2563
+ Supports wildcards (`*`).
2564
+ :param master_timeout: The period to wait for a connection to the master node.
2565
+ If no response is received before the timeout expires, the request fails
2566
+ and returns an error.
2567
+ """
2568
+ if name in SKIP_IN_PATH:
2569
+ raise ValueError("Empty value passed for parameter 'name'")
2570
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
2571
+ __path = f'/_data_stream/{__path_parts["name"]}/_mappings'
2572
+ __query: t.Dict[str, t.Any] = {}
2573
+ if error_trace is not None:
2574
+ __query["error_trace"] = error_trace
2575
+ if filter_path is not None:
2576
+ __query["filter_path"] = filter_path
2577
+ if human is not None:
2578
+ __query["human"] = human
2579
+ if master_timeout is not None:
2580
+ __query["master_timeout"] = master_timeout
2581
+ if pretty is not None:
2582
+ __query["pretty"] = pretty
2583
+ __headers = {"accept": "application/json"}
2584
+ return await self.perform_request( # type: ignore[return-value]
2585
+ "GET",
2586
+ __path,
2587
+ params=__query,
2588
+ headers=__headers,
2589
+ endpoint_id="indices.get_data_stream_mappings",
2590
+ path_parts=__path_parts,
2591
+ )
2592
+
2545
2593
  @_rewrite_parameters()
2546
2594
  async def get_data_stream_options(
2547
2595
  self,
@@ -3638,11 +3686,7 @@ class IndicesClient(NamespacedClient):
3638
3686
  __body["downsampling"] = downsampling
3639
3687
  if enabled is not None:
3640
3688
  __body["enabled"] = enabled
3641
- if not __body:
3642
- __body = None # type: ignore[assignment]
3643
- __headers = {"accept": "application/json"}
3644
- if __body is not None:
3645
- __headers["content-type"] = "application/json"
3689
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3646
3690
  return await self.perform_request( # type: ignore[return-value]
3647
3691
  "PUT",
3648
3692
  __path,
@@ -3653,6 +3697,83 @@ class IndicesClient(NamespacedClient):
3653
3697
  path_parts=__path_parts,
3654
3698
  )
3655
3699
 
3700
+ @_rewrite_parameters(
3701
+ body_name="mappings",
3702
+ )
3703
+ async def put_data_stream_mappings(
3704
+ self,
3705
+ *,
3706
+ name: t.Union[str, t.Sequence[str]],
3707
+ mappings: t.Optional[t.Mapping[str, t.Any]] = None,
3708
+ body: t.Optional[t.Mapping[str, t.Any]] = None,
3709
+ dry_run: t.Optional[bool] = None,
3710
+ error_trace: t.Optional[bool] = None,
3711
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3712
+ human: t.Optional[bool] = None,
3713
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3714
+ pretty: t.Optional[bool] = None,
3715
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3716
+ ) -> ObjectApiResponse[t.Any]:
3717
+ """
3718
+ .. raw:: html
3719
+
3720
+ <p>Update data stream mappings.</p>
3721
+ <p>This API can be used to override mappings on specific data streams. These overrides will take precedence over what
3722
+ is specified in the template that the data stream matches. The mapping change is only applied to new write indices
3723
+ that are created during rollover after this API is called. No indices are changed by this API.</p>
3724
+
3725
+
3726
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-mappings>`_
3727
+
3728
+ :param name: A comma-separated list of data streams or data stream patterns.
3729
+ :param mappings:
3730
+ :param dry_run: If `true`, the request does not actually change the mappings
3731
+ on any data streams. Instead, it simulates changing the settings and reports
3732
+ back to the user what would have happened had these settings actually been
3733
+ applied.
3734
+ :param master_timeout: The period to wait for a connection to the master node.
3735
+ If no response is received before the timeout expires, the request fails
3736
+ and returns an error.
3737
+ :param timeout: The period to wait for a response. If no response is received
3738
+ before the timeout expires, the request fails and returns an error.
3739
+ """
3740
+ if name in SKIP_IN_PATH:
3741
+ raise ValueError("Empty value passed for parameter 'name'")
3742
+ if mappings is None and body is None:
3743
+ raise ValueError(
3744
+ "Empty value passed for parameters 'mappings' and 'body', one of them should be set."
3745
+ )
3746
+ elif mappings is not None and body is not None:
3747
+ raise ValueError("Cannot set both 'mappings' and 'body'")
3748
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
3749
+ __path = f'/_data_stream/{__path_parts["name"]}/_mappings'
3750
+ __query: t.Dict[str, t.Any] = {}
3751
+ if dry_run is not None:
3752
+ __query["dry_run"] = dry_run
3753
+ if error_trace is not None:
3754
+ __query["error_trace"] = error_trace
3755
+ if filter_path is not None:
3756
+ __query["filter_path"] = filter_path
3757
+ if human is not None:
3758
+ __query["human"] = human
3759
+ if master_timeout is not None:
3760
+ __query["master_timeout"] = master_timeout
3761
+ if pretty is not None:
3762
+ __query["pretty"] = pretty
3763
+ if timeout is not None:
3764
+ __query["timeout"] = timeout
3765
+ __body = mappings if mappings is not None else body
3766
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3767
+ return await self.perform_request( # type: ignore[return-value]
3768
+ "PUT",
3769
+ __path,
3770
+ params=__query,
3771
+ headers=__headers,
3772
+ body=__body,
3773
+ endpoint_id="indices.put_data_stream_mappings",
3774
+ path_parts=__path_parts,
3775
+ )
3776
+
3656
3777
  @_rewrite_parameters(
3657
3778
  body_fields=("failure_store",),
3658
3779
  )
@@ -3721,11 +3842,7 @@ class IndicesClient(NamespacedClient):
3721
3842
  if not __body:
3722
3843
  if failure_store is not None:
3723
3844
  __body["failure_store"] = failure_store
3724
- if not __body:
3725
- __body = None # type: ignore[assignment]
3726
- __headers = {"accept": "application/json"}
3727
- if __body is not None:
3728
- __headers["content-type"] = "application/json"
3845
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3729
3846
  return await self.perform_request( # type: ignore[return-value]
3730
3847
  "PUT",
3731
3848
  __path,
@@ -4549,6 +4666,7 @@ class IndicesClient(NamespacedClient):
4549
4666
  For data streams, the API runs the refresh operation on the stream’s backing indices.</p>
4550
4667
  <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.
4551
4668
  You can change this default interval with the <code>index.refresh_interval</code> setting.</p>
4669
+ <p>In Elastic Cloud Serverless, the default refresh interval is 5 seconds across all indices.</p>
4552
4670
  <p>Refresh requests are synchronous and do not return a response until the refresh operation completes.</p>
4553
4671
  <p>Refreshes are resource-intensive.
4554
4672
  To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.</p>
@@ -4937,7 +5055,18 @@ class IndicesClient(NamespacedClient):
4937
5055
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4938
5056
  human: t.Optional[bool] = None,
4939
5057
  ignore_unavailable: t.Optional[bool] = None,
5058
+ mode: t.Optional[
5059
+ t.Union[
5060
+ t.Sequence[
5061
+ t.Union[
5062
+ str, t.Literal["logsdb", "lookup", "standard", "time_series"]
5063
+ ]
5064
+ ],
5065
+ t.Union[str, t.Literal["logsdb", "lookup", "standard", "time_series"]],
5066
+ ]
5067
+ ] = None,
4940
5068
  pretty: t.Optional[bool] = None,
5069
+ project_routing: t.Optional[str] = None,
4941
5070
  ) -> ObjectApiResponse[t.Any]:
4942
5071
  """
4943
5072
  .. raw:: html
@@ -4963,6 +5092,12 @@ class IndicesClient(NamespacedClient):
4963
5092
  as `open,hidden`.
4964
5093
  :param ignore_unavailable: If `false`, the request returns an error if it targets
4965
5094
  a missing or closed index.
5095
+ :param mode: Filter indices by index mode - standard, lookup, time_series, etc.
5096
+ Comma-separated list of IndexMode. Empty means no filter.
5097
+ :param project_routing: Specifies a subset of projects to target using project
5098
+ metadata tags in a subset of Lucene query syntax. Allowed Lucene queries:
5099
+ the _alias tag and a single value (possibly wildcarded). Examples: _alias:my-project
5100
+ _alias:_origin _alias:*pr* Supported in serverless only.
4966
5101
  """
4967
5102
  if name in SKIP_IN_PATH:
4968
5103
  raise ValueError("Empty value passed for parameter 'name'")
@@ -4981,8 +5116,12 @@ class IndicesClient(NamespacedClient):
4981
5116
  __query["human"] = human
4982
5117
  if ignore_unavailable is not None:
4983
5118
  __query["ignore_unavailable"] = ignore_unavailable
5119
+ if mode is not None:
5120
+ __query["mode"] = mode
4984
5121
  if pretty is not None:
4985
5122
  __query["pretty"] = pretty
5123
+ if project_routing is not None:
5124
+ __query["project_routing"] = project_routing
4986
5125
  __headers = {"accept": "application/json"}
4987
5126
  return await self.perform_request( # type: ignore[return-value]
4988
5127
  "GET",
@@ -5022,7 +5161,7 @@ class IndicesClient(NamespacedClient):
5022
5161
  .. raw:: html
5023
5162
 
5024
5163
  <p>Roll over to a new index.
5025
- TIP: It is recommended to use the index lifecycle rollover action to automate rollovers.</p>
5164
+ TIP: We recommend using the index lifecycle rollover action to automate rollovers. However, Serverless does not support Index Lifecycle Management (ILM), so don't use this approach in the Serverless context.</p>
5026
5165
  <p>The rollover API creates a new index for a data stream or index alias.
5027
5166
  The API behavior depends on the rollover target.</p>
5028
5167
  <p><strong>Roll over a data stream</strong></p>
@@ -5399,11 +5538,7 @@ class IndicesClient(NamespacedClient):
5399
5538
  __body["aliases"] = aliases
5400
5539
  if settings is not None:
5401
5540
  __body["settings"] = settings
5402
- if not __body:
5403
- __body = None # type: ignore[assignment]
5404
- __headers = {"accept": "application/json"}
5405
- if __body is not None:
5406
- __headers["content-type"] = "application/json"
5541
+ __headers = {"accept": "application/json", "content-type": "application/json"}
5407
5542
  return await self.perform_request( # type: ignore[return-value]
5408
5543
  "PUT",
5409
5544
  __path,
@@ -5414,7 +5549,9 @@ class IndicesClient(NamespacedClient):
5414
5549
  path_parts=__path_parts,
5415
5550
  )
5416
5551
 
5417
- @_rewrite_parameters()
5552
+ @_rewrite_parameters(
5553
+ body_name="index_template",
5554
+ )
5418
5555
  async def simulate_index_template(
5419
5556
  self,
5420
5557
  *,
@@ -5425,6 +5562,8 @@ class IndicesClient(NamespacedClient):
5425
5562
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
5426
5563
  human: t.Optional[bool] = None,
5427
5564
  include_defaults: t.Optional[bool] = None,
5565
+ index_template: t.Optional[t.Mapping[str, t.Any]] = None,
5566
+ body: t.Optional[t.Mapping[str, t.Any]] = None,
5428
5567
  master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
5429
5568
  pretty: t.Optional[bool] = None,
5430
5569
  ) -> ObjectApiResponse[t.Any]:
@@ -5444,12 +5583,15 @@ class IndicesClient(NamespacedClient):
5444
5583
  only be dry-run added if new or can also replace an existing one
5445
5584
  :param include_defaults: If true, returns all relevant default configurations
5446
5585
  for the index template.
5586
+ :param index_template:
5447
5587
  :param master_timeout: Period to wait for a connection to the master node. If
5448
5588
  no response is received before the timeout expires, the request fails and
5449
5589
  returns an error.
5450
5590
  """
5451
5591
  if name in SKIP_IN_PATH:
5452
5592
  raise ValueError("Empty value passed for parameter 'name'")
5593
+ if index_template is not None and body is not None:
5594
+ raise ValueError("Cannot set both 'index_template' and 'body'")
5453
5595
  __path_parts: t.Dict[str, str] = {"name": _quote(name)}
5454
5596
  __path = f'/_index_template/_simulate_index/{__path_parts["name"]}'
5455
5597
  __query: t.Dict[str, t.Any] = {}
@@ -5469,12 +5611,18 @@ class IndicesClient(NamespacedClient):
5469
5611
  __query["master_timeout"] = master_timeout
5470
5612
  if pretty is not None:
5471
5613
  __query["pretty"] = pretty
5614
+ __body = index_template if index_template is not None else body
5615
+ if not __body:
5616
+ __body = None
5472
5617
  __headers = {"accept": "application/json"}
5618
+ if __body is not None:
5619
+ __headers["content-type"] = "application/json"
5473
5620
  return await self.perform_request( # type: ignore[return-value]
5474
5621
  "POST",
5475
5622
  __path,
5476
5623
  params=__query,
5477
5624
  headers=__headers,
5625
+ body=__body,
5478
5626
  endpoint_id="indices.simulate_index_template",
5479
5627
  path_parts=__path_parts,
5480
5628
  )
@@ -5742,11 +5890,7 @@ class IndicesClient(NamespacedClient):
5742
5890
  __body["aliases"] = aliases
5743
5891
  if settings is not None:
5744
5892
  __body["settings"] = settings
5745
- if not __body:
5746
- __body = None # type: ignore[assignment]
5747
- __headers = {"accept": "application/json"}
5748
- if __body is not None:
5749
- __headers["content-type"] = "application/json"
5893
+ __headers = {"accept": "application/json", "content-type": "application/json"}
5750
5894
  return await self.perform_request( # type: ignore[return-value]
5751
5895
  "PUT",
5752
5896
  __path,
@@ -5823,8 +5967,8 @@ class IndicesClient(NamespacedClient):
5823
5967
  are requested).
5824
5968
  :param include_unloaded_segments: If true, the response includes information
5825
5969
  from segments that are not loaded into memory.
5826
- :param level: Indicates whether statistics are aggregated at the cluster, index,
5827
- or shard level.
5970
+ :param level: Indicates whether statistics are aggregated at the cluster, indices,
5971
+ or shards level.
5828
5972
  """
5829
5973
  __path_parts: t.Dict[str, str]
5830
5974
  if index not in SKIP_IN_PATH and metric not in SKIP_IN_PATH:
@@ -5990,8 +6134,8 @@ class IndicesClient(NamespacedClient):
5990
6134
  :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed.
5991
6135
  :param analyzer: Analyzer to use for the query string. This parameter can only
5992
6136
  be used when the `q` query string parameter is specified.
5993
- :param default_operator: The default operator for query string query: `AND` or
5994
- `OR`.
6137
+ :param default_operator: The default operator for query string query: `and` or
6138
+ `or`.
5995
6139
  :param df: Field to use as default where no field prefix is given in the query
5996
6140
  string. This parameter can only be used when the `q` query string parameter
5997
6141
  is specified.