@@ -230,6 +230,51 @@ async def analyze(
230
230
path_parts = __path_parts ,
231
231
)
232
232
233
+ @_rewrite_parameters ()
234
+ @_stability_warning (Stability .EXPERIMENTAL )
235
+ async def cancel_migrate_reindex (
236
+ self ,
237
+ * ,
238
+ index : t .Union [str , t .Sequence [str ]],
239
+ error_trace : t .Optional [bool ] = None ,
240
+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
241
+ human : t .Optional [bool ] = None ,
242
+ pretty : t .Optional [bool ] = None ,
243
+ ) -> ObjectApiResponse [t .Any ]:
244
+ """
245
+ .. raw:: html
246
+
247
+ <p>Cancel a migration reindex operation.</p>
248
+ <p>Cancel a migration reindex attempt for a data stream or index.</p>
249
+
250
+
251
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
252
+
253
+ :param index: The index or data stream name
254
+ """
255
+ if index in SKIP_IN_PATH :
256
+ raise ValueError ("Empty value passed for parameter 'index'" )
257
+ __path_parts : t .Dict [str , str ] = {"index" : _quote (index )}
258
+ __path = f'/_migration/reindex/{ __path_parts ["index" ]} /_cancel'
259
+ __query : t .Dict [str , t .Any ] = {}
260
+ if error_trace is not None :
261
+ __query ["error_trace" ] = error_trace
262
+ if filter_path is not None :
263
+ __query ["filter_path" ] = filter_path
264
+ if human is not None :
265
+ __query ["human" ] = human
266
+ if pretty is not None :
267
+ __query ["pretty" ] = pretty
268
+ __headers = {"accept" : "application/json" }
269
+ return await self .perform_request ( # type: ignore[return-value]
270
+ "POST" ,
271
+ __path ,
272
+ params = __query ,
273
+ headers = __headers ,
274
+ endpoint_id = "indices.cancel_migrate_reindex" ,
275
+ path_parts = __path_parts ,
276
+ )
277
+
233
278
@_rewrite_parameters ()
234
279
async def clear_cache (
235
280
self ,
@@ -710,6 +755,71 @@ async def create_data_stream(
710
755
path_parts = __path_parts ,
711
756
)
712
757
758
+ @_rewrite_parameters (
759
+ body_name = "create_from" ,
760
+ )
761
+ @_stability_warning (Stability .EXPERIMENTAL )
762
+ async def create_from (
763
+ self ,
764
+ * ,
765
+ source : str ,
766
+ dest : str ,
767
+ create_from : t .Optional [t .Mapping [str , t .Any ]] = None ,
768
+ body : t .Optional [t .Mapping [str , t .Any ]] = None ,
769
+ error_trace : t .Optional [bool ] = None ,
770
+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
771
+ human : t .Optional [bool ] = None ,
772
+ pretty : t .Optional [bool ] = None ,
773
+ ) -> ObjectApiResponse [t .Any ]:
774
+ """
775
+ .. raw:: html
776
+
777
+ <p>Create an index from a source index.</p>
778
+ <p>Copy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values.</p>
779
+
780
+
781
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
782
+
783
+ :param source: The source index or data stream name
784
+ :param dest: The destination index or data stream name
785
+ :param create_from:
786
+ """
787
+ if source in SKIP_IN_PATH :
788
+ raise ValueError ("Empty value passed for parameter 'source'" )
789
+ if dest in SKIP_IN_PATH :
790
+ raise ValueError ("Empty value passed for parameter 'dest'" )
791
+ if create_from is None and body is None :
792
+ raise ValueError (
793
+ "Empty value passed for parameters 'create_from' and 'body', one of them should be set."
794
+ )
795
+ elif create_from is not None and body is not None :
796
+ raise ValueError ("Cannot set both 'create_from' and 'body'" )
797
+ __path_parts : t .Dict [str , str ] = {
798
+ "source" : _quote (source ),
799
+ "dest" : _quote (dest ),
800
+ }
801
+ __path = f'/_create_from/{ __path_parts ["source" ]} /{ __path_parts ["dest" ]} '
802
+ __query : t .Dict [str , t .Any ] = {}
803
+ if error_trace is not None :
804
+ __query ["error_trace" ] = error_trace
805
+ if filter_path is not None :
806
+ __query ["filter_path" ] = filter_path
807
+ if human is not None :
808
+ __query ["human" ] = human
809
+ if pretty is not None :
810
+ __query ["pretty" ] = pretty
811
+ __body = create_from if create_from is not None else body
812
+ __headers = {"accept" : "application/json" , "content-type" : "application/json" }
813
+ return await self .perform_request ( # type: ignore[return-value]
814
+ "PUT" ,
815
+ __path ,
816
+ params = __query ,
817
+ headers = __headers ,
818
+ body = __body ,
819
+ endpoint_id = "indices.create_from" ,
820
+ path_parts = __path_parts ,
821
+ )
822
+
713
823
@_rewrite_parameters ()
714
824
async def data_streams_stats (
715
825
self ,
@@ -2587,6 +2697,51 @@ async def get_mapping(
2587
2697
path_parts = __path_parts ,
2588
2698
)
2589
2699
2700
+ @_rewrite_parameters ()
2701
+ @_stability_warning (Stability .EXPERIMENTAL )
2702
+ async def get_migrate_reindex_status (
2703
+ self ,
2704
+ * ,
2705
+ index : t .Union [str , t .Sequence [str ]],
2706
+ error_trace : t .Optional [bool ] = None ,
2707
+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
2708
+ human : t .Optional [bool ] = None ,
2709
+ pretty : t .Optional [bool ] = None ,
2710
+ ) -> ObjectApiResponse [t .Any ]:
2711
+ """
2712
+ .. raw:: html
2713
+
2714
+ <p>Get the migration reindexing status.</p>
2715
+ <p>Get the status of a migration reindex attempt for a data stream or index.</p>
2716
+
2717
+
2718
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
2719
+
2720
+ :param index: The index or data stream name.
2721
+ """
2722
+ if index in SKIP_IN_PATH :
2723
+ raise ValueError ("Empty value passed for parameter 'index'" )
2724
+ __path_parts : t .Dict [str , str ] = {"index" : _quote (index )}
2725
+ __path = f'/_migration/reindex/{ __path_parts ["index" ]} /_status'
2726
+ __query : t .Dict [str , t .Any ] = {}
2727
+ if error_trace is not None :
2728
+ __query ["error_trace" ] = error_trace
2729
+ if filter_path is not None :
2730
+ __query ["filter_path" ] = filter_path
2731
+ if human is not None :
2732
+ __query ["human" ] = human
2733
+ if pretty is not None :
2734
+ __query ["pretty" ] = pretty
2735
+ __headers = {"accept" : "application/json" }
2736
+ return await self .perform_request ( # type: ignore[return-value]
2737
+ "GET" ,
2738
+ __path ,
2739
+ params = __query ,
2740
+ headers = __headers ,
2741
+ endpoint_id = "indices.get_migrate_reindex_status" ,
2742
+ path_parts = __path_parts ,
2743
+ )
2744
+
2590
2745
@_rewrite_parameters ()
2591
2746
async def get_settings (
2592
2747
self ,
@@ -2756,6 +2911,62 @@ async def get_template(
2756
2911
path_parts = __path_parts ,
2757
2912
)
2758
2913
2914
+ @_rewrite_parameters (
2915
+ body_name = "reindex" ,
2916
+ )
2917
+ @_stability_warning (Stability .EXPERIMENTAL )
2918
+ async def migrate_reindex (
2919
+ self ,
2920
+ * ,
2921
+ reindex : t .Optional [t .Mapping [str , t .Any ]] = None ,
2922
+ body : t .Optional [t .Mapping [str , t .Any ]] = None ,
2923
+ error_trace : t .Optional [bool ] = None ,
2924
+ filter_path : t .Optional [t .Union [str , t .Sequence [str ]]] = None ,
2925
+ human : t .Optional [bool ] = None ,
2926
+ pretty : t .Optional [bool ] = None ,
2927
+ ) -> ObjectApiResponse [t .Any ]:
2928
+ """
2929
+ .. raw:: html
2930
+
2931
+ <p>Reindex legacy backing indices.</p>
2932
+ <p>Reindex all legacy backing indices for a data stream.
2933
+ This operation occurs in a persistent task.
2934
+ The persistent task ID is returned immediately and the reindexing work is completed in that task.</p>
2935
+
2936
+
2937
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/master/migrate-data-stream.html>`_
2938
+
2939
+ :param reindex:
2940
+ """
2941
+ if reindex is None and body is None :
2942
+ raise ValueError (
2943
+ "Empty value passed for parameters 'reindex' and 'body', one of them should be set."
2944
+ )
2945
+ elif reindex is not None and body is not None :
2946
+ raise ValueError ("Cannot set both 'reindex' and 'body'" )
2947
+ __path_parts : t .Dict [str , str ] = {}
2948
+ __path = "/_migration/reindex"
2949
+ __query : t .Dict [str , t .Any ] = {}
2950
+ if error_trace is not None :
2951
+ __query ["error_trace" ] = error_trace
2952
+ if filter_path is not None :
2953
+ __query ["filter_path" ] = filter_path
2954
+ if human is not None :
2955
+ __query ["human" ] = human
2956
+ if pretty is not None :
2957
+ __query ["pretty" ] = pretty
2958
+ __body = reindex if reindex is not None else body
2959
+ __headers = {"accept" : "application/json" , "content-type" : "application/json" }
2960
+ return await self .perform_request ( # type: ignore[return-value]
2961
+ "POST" ,
2962
+ __path ,
2963
+ params = __query ,
2964
+ headers = __headers ,
2965
+ body = __body ,
2966
+ endpoint_id = "indices.migrate_reindex" ,
2967
+ path_parts = __path_parts ,
2968
+ )
2969
+
2759
2970
@_rewrite_parameters ()
2760
2971
async def migrate_to_data_stream (
2761
2972
self ,
0 commit comments