@@ -825,7 +825,11 @@ async def create_from(
825825 if pretty is not None :
826826 __query ["pretty" ] = pretty
827827 __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"
829833 return await self .perform_request ( # type: ignore[return-value]
830834 "PUT" ,
831835 __path ,
@@ -2467,6 +2471,57 @@ async def get_data_stream(
24672471 path_parts = __path_parts ,
24682472 )
24692473
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+
24702525 @_rewrite_parameters ()
24712526 async def get_field_mapping (
24722527 self ,
@@ -3468,6 +3523,84 @@ async def put_data_lifecycle(
34683523 path_parts = __path_parts ,
34693524 )
34703525
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+
34713604 @_rewrite_parameters (
34723605 body_fields = (
34733606 "allow_auto_create" ,
@@ -4207,6 +4340,7 @@ async def refresh(
42074340 For data streams, the API runs the refresh operation on the stream’s backing indices.</p>
42084341 <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.
42094342 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>
42104344 <p>Refresh requests are synchronous and do not return a response until the refresh operation completes.</p>
42114345 <p>Refreshes are resource-intensive.
42124346 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(
49775111 path_parts = __path_parts ,
49785112 )
49795113
4980- @_rewrite_parameters ()
5114+ @_rewrite_parameters (
5115+ body_name = "index_template" ,
5116+ )
49815117 async def simulate_index_template (
49825118 self ,
49835119 * ,
@@ -4988,6 +5124,8 @@ async def simulate_index_template(
49885124 filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
49895125 human : t .Optional [bool ] = None ,
49905126 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 ,
49915129 master_timeout : t .Optional [t .Union [str , t .Literal [- 1 ], t .Literal [0 ]]] = None ,
49925130 pretty : t .Optional [bool ] = None ,
49935131 ) -> ObjectApiResponse [t .Any ]:
@@ -5007,12 +5145,19 @@ async def simulate_index_template(
50075145 only be dry-run added if new or can also replace an existing one
50085146 :param include_defaults: If true, returns all relevant default configurations
50095147 for the index template.
5148+ :param index_template:
50105149 :param master_timeout: Period to wait for a connection to the master node. If
50115150 no response is received before the timeout expires, the request fails and
50125151 returns an error.
50135152 """
50145153 if name in SKIP_IN_PATH :
50155154 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'" )
50165161 __path_parts : t .Dict [str , str ] = {"name" : _quote (name )}
50175162 __path = f'/_index_template/_simulate_index/{ __path_parts ["name" ]} '
50185163 __query : t .Dict [str , t .Any ] = {}
@@ -5032,12 +5177,18 @@ async def simulate_index_template(
50325177 __query ["master_timeout" ] = master_timeout
50335178 if pretty is not None :
50345179 __query ["pretty" ] = pretty
5180+ __body = index_template if index_template is not None else body
5181+ if not __body :
5182+ __body = None
50355183 __headers = {"accept" : "application/json" }
5184+ if __body is not None :
5185+ __headers ["content-type" ] = "application/json"
50365186 return await self .perform_request ( # type: ignore[return-value]
50375187 "POST" ,
50385188 __path ,
50395189 params = __query ,
50405190 headers = __headers ,
5191+ body = __body ,
50415192 endpoint_id = "indices.simulate_index_template" ,
50425193 path_parts = __path_parts ,
50435194 )
0 commit comments