@@ -825,7 +825,11 @@ async def create_from(
825
825
if pretty is not None :
826
826
__query ["pretty" ] = pretty
827
827
__body = create_from if create_from is not None else body
828
- __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"
829
833
return await self .perform_request ( # type: ignore[return-value]
830
834
"PUT" ,
831
835
__path ,
@@ -2467,6 +2471,57 @@ async def get_data_stream(
2467
2471
path_parts = __path_parts ,
2468
2472
)
2469
2473
2474
+ @_rewrite_parameters ()
2475
+ async def get_data_stream_settings (
2476
+ self ,
2477
+ * ,
2478
+ name : t .Union [str , t .Sequence [str ]],
2479
+ error_trace : t .Optional [bool ] = None ,
2480
+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
2481
+ human : t .Optional [bool ] = None ,
2482
+ master_timeout : t .Optional [t .Union [str , t .Literal [- 1 ], t .Literal [0 ]]] = None ,
2483
+ pretty : t .Optional [bool ] = None ,
2484
+ ) -> ObjectApiResponse [t .Any ]:
2485
+ """
2486
+ .. raw:: html
2487
+
2488
+ <p>Get data stream settings.</p>
2489
+ <p>Get setting information for one or more data streams.</p>
2490
+
2491
+
2492
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-get-data-stream-settings.html>`_
2493
+
2494
+ :param name: A comma-separated list of data streams or data stream patterns.
2495
+ Supports wildcards (`*`).
2496
+ :param master_timeout: The period to wait for a connection to the master node.
2497
+ If no response is received before the timeout expires, the request fails
2498
+ and returns an error.
2499
+ """
2500
+ if name in SKIP_IN_PATH :
2501
+ raise ValueError ("Empty value passed for parameter 'name'" )
2502
+ __path_parts : t .Dict [str , str ] = {"name" : _quote (name )}
2503
+ __path = f'/_data_stream/{ __path_parts ["name" ]} /_settings'
2504
+ __query : t .Dict [str , t .Any ] = {}
2505
+ if error_trace is not None :
2506
+ __query ["error_trace" ] = error_trace
2507
+ if filter_path is not None :
2508
+ __query ["filter_path" ] = filter_path
2509
+ if human is not None :
2510
+ __query ["human" ] = human
2511
+ if master_timeout is not None :
2512
+ __query ["master_timeout" ] = master_timeout
2513
+ if pretty is not None :
2514
+ __query ["pretty" ] = pretty
2515
+ __headers = {"accept" : "application/json" }
2516
+ return await self .perform_request ( # type: ignore[return-value]
2517
+ "GET" ,
2518
+ __path ,
2519
+ params = __query ,
2520
+ headers = __headers ,
2521
+ endpoint_id = "indices.get_data_stream_settings" ,
2522
+ path_parts = __path_parts ,
2523
+ )
2524
+
2470
2525
@_rewrite_parameters ()
2471
2526
async def get_field_mapping (
2472
2527
self ,
@@ -3468,6 +3523,84 @@ async def put_data_lifecycle(
3468
3523
path_parts = __path_parts ,
3469
3524
)
3470
3525
3526
+ @_rewrite_parameters (
3527
+ body_name = "settings" ,
3528
+ )
3529
+ async def put_data_stream_settings (
3530
+ self ,
3531
+ * ,
3532
+ name : t .Union [str , t .Sequence [str ]],
3533
+ settings : t .Optional [t .Mapping [str , t .Any ]] = None ,
3534
+ body : t .Optional [t .Mapping [str , t .Any ]] = None ,
3535
+ dry_run : t .Optional [bool ] = None ,
3536
+ error_trace : t .Optional [bool ] = None ,
3537
+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
3538
+ human : t .Optional [bool ] = None ,
3539
+ master_timeout : t .Optional [t .Union [str , t .Literal [- 1 ], t .Literal [0 ]]] = None ,
3540
+ pretty : t .Optional [bool ] = None ,
3541
+ timeout : t .Optional [t .Union [str , t .Literal [- 1 ], t .Literal [0 ]]] = None ,
3542
+ ) -> ObjectApiResponse [t .Any ]:
3543
+ """
3544
+ .. raw:: html
3545
+
3546
+ <p>Update data stream settings.</p>
3547
+ <p>This API can be used to override settings on specific data streams. These overrides will take precedence over what
3548
+ is specified in the template that the data stream matches. To prevent your data stream from getting into an invalid state,
3549
+ only certain settings are allowed. If possible, the setting change is applied to all
3550
+ backing indices. Otherwise, it will be applied when the data stream is next rolled over.</p>
3551
+
3552
+
3553
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-put-data-stream-settings.html>`_
3554
+
3555
+ :param name: A comma-separated list of data streams or data stream patterns.
3556
+ :param settings:
3557
+ :param dry_run: If `true`, the request does not actually change the settings
3558
+ on any data streams or indices. Instead, it simulates changing the settings
3559
+ and reports back to the user what would have happened had these settings
3560
+ actually been applied.
3561
+ :param master_timeout: The period to wait for a connection to the master node.
3562
+ If no response is received before the timeout expires, the request fails
3563
+ and returns an error.
3564
+ :param timeout: The period to wait for a response. If no response is received
3565
+ before the timeout expires, the request fails and returns an error.
3566
+ """
3567
+ if name in SKIP_IN_PATH :
3568
+ raise ValueError ("Empty value passed for parameter 'name'" )
3569
+ if settings is None and body is None :
3570
+ raise ValueError (
3571
+ "Empty value passed for parameters 'settings' and 'body', one of them should be set."
3572
+ )
3573
+ elif settings is not None and body is not None :
3574
+ raise ValueError ("Cannot set both 'settings' and 'body'" )
3575
+ __path_parts : t .Dict [str , str ] = {"name" : _quote (name )}
3576
+ __path = f'/_data_stream/{ __path_parts ["name" ]} /_settings'
3577
+ __query : t .Dict [str , t .Any ] = {}
3578
+ if dry_run is not None :
3579
+ __query ["dry_run" ] = dry_run
3580
+ if error_trace is not None :
3581
+ __query ["error_trace" ] = error_trace
3582
+ if filter_path is not None :
3583
+ __query ["filter_path" ] = filter_path
3584
+ if human is not None :
3585
+ __query ["human" ] = human
3586
+ if master_timeout is not None :
3587
+ __query ["master_timeout" ] = master_timeout
3588
+ if pretty is not None :
3589
+ __query ["pretty" ] = pretty
3590
+ if timeout is not None :
3591
+ __query ["timeout" ] = timeout
3592
+ __body = settings if settings is not None else body
3593
+ __headers = {"accept" : "application/json" , "content-type" : "application/json" }
3594
+ return await self .perform_request ( # type: ignore[return-value]
3595
+ "PUT" ,
3596
+ __path ,
3597
+ params = __query ,
3598
+ headers = __headers ,
3599
+ body = __body ,
3600
+ endpoint_id = "indices.put_data_stream_settings" ,
3601
+ path_parts = __path_parts ,
3602
+ )
3603
+
3471
3604
@_rewrite_parameters (
3472
3605
body_fields = (
3473
3606
"allow_auto_create" ,
@@ -4207,6 +4340,7 @@ async def refresh(
4207
4340
For data streams, the API runs the refresh operation on the stream’s backing indices.</p>
4208
4341
<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
4342
You can change this default interval with the <code>index.refresh_interval</code> setting.</p>
4343
+ <p>In Elastic Cloud Serverless, the default refresh interval is 5 seconds across all indices.</p>
4210
4344
<p>Refresh requests are synchronous and do not return a response until the refresh operation completes.</p>
4211
4345
<p>Refreshes are resource-intensive.
4212
4346
To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.</p>
@@ -4977,7 +5111,9 @@ async def shrink(
4977
5111
path_parts = __path_parts ,
4978
5112
)
4979
5113
4980
- @_rewrite_parameters ()
5114
+ @_rewrite_parameters (
5115
+ body_name = "index_template" ,
5116
+ )
4981
5117
async def simulate_index_template (
4982
5118
self ,
4983
5119
* ,
@@ -4988,6 +5124,8 @@ async def simulate_index_template(
4988
5124
filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
4989
5125
human : t .Optional [bool ] = None ,
4990
5126
include_defaults : t .Optional [bool ] = None ,
5127
+ index_template : t .Optional [t .Mapping [str , t .Any ]] = None ,
5128
+ body : t .Optional [t .Mapping [str , t .Any ]] = None ,
4991
5129
master_timeout : t .Optional [t .Union [str , t .Literal [- 1 ], t .Literal [0 ]]] = None ,
4992
5130
pretty : t .Optional [bool ] = None ,
4993
5131
) -> ObjectApiResponse [t .Any ]:
@@ -5007,12 +5145,19 @@ async def simulate_index_template(
5007
5145
only be dry-run added if new or can also replace an existing one
5008
5146
:param include_defaults: If true, returns all relevant default configurations
5009
5147
for the index template.
5148
+ :param index_template:
5010
5149
:param master_timeout: Period to wait for a connection to the master node. If
5011
5150
no response is received before the timeout expires, the request fails and
5012
5151
returns an error.
5013
5152
"""
5014
5153
if name in SKIP_IN_PATH :
5015
5154
raise ValueError ("Empty value passed for parameter 'name'" )
5155
+ if index_template is None and body is None :
5156
+ raise ValueError (
5157
+ "Empty value passed for parameters 'index_template' and 'body', one of them should be set."
5158
+ )
5159
+ elif index_template is not None and body is not None :
5160
+ raise ValueError ("Cannot set both 'index_template' and 'body'" )
5016
5161
__path_parts : t .Dict [str , str ] = {"name" : _quote (name )}
5017
5162
__path = f'/_index_template/_simulate_index/{ __path_parts ["name" ]} '
5018
5163
__query : t .Dict [str , t .Any ] = {}
@@ -5032,12 +5177,18 @@ async def simulate_index_template(
5032
5177
__query ["master_timeout" ] = master_timeout
5033
5178
if pretty is not None :
5034
5179
__query ["pretty" ] = pretty
5180
+ __body = index_template if index_template is not None else body
5181
+ if not __body :
5182
+ __body = None
5035
5183
__headers = {"accept" : "application/json" }
5184
+ if __body is not None :
5185
+ __headers ["content-type" ] = "application/json"
5036
5186
return await self .perform_request ( # type: ignore[return-value]
5037
5187
"POST" ,
5038
5188
__path ,
5039
5189
params = __query ,
5040
5190
headers = __headers ,
5191
+ body = __body ,
5041
5192
endpoint_id = "indices.simulate_index_template" ,
5042
5193
path_parts = __path_parts ,
5043
5194
)
0 commit comments