@@ -16,7 +16,8 @@ def raw_indexes(options = {})
1616 def swap_indexes ( *options )
1717 mapped_array = options . map { |arr | { indexes : arr } }
1818
19- http_post '/swap-indexes' , mapped_array
19+ response = http_post '/swap-indexes' , mapped_array
20+ Models ::Task . new ( response , task_endpoint )
2021 end
2122
2223 def indexes ( options = { } )
@@ -35,14 +36,20 @@ def indexes(options = {})
3536 def create_index ( index_uid , options = { } )
3637 body = Utils . transform_attributes ( options . merge ( uid : index_uid ) )
3738
38- http_post '/indexes' , body
39+ response = http_post '/indexes' , body
40+
41+ Models ::Task . new ( response , task_endpoint )
3942 end
4043
4144 # Synchronous version of create_index.
4245 # Waits for the task to be achieved, be careful when using it.
4346 def create_index! ( index_uid , options = { } )
44- task = create_index ( index_uid , options )
45- wait_for_task ( task [ 'taskUid' ] )
47+ Utils . soft_deprecate (
48+ 'Client#create_index!' ,
49+ "client.create_index('#{ index_uid } ').await"
50+ )
51+
52+ create_index ( index_uid , options ) . await
4653 end
4754
4855 def delete_index ( index_uid )
@@ -118,7 +125,8 @@ def stats
118125 ### DUMPS
119126
120127 def create_dump
121- http_post '/dumps'
128+ response = http_post '/dumps'
129+ Models ::Task . new ( response , task_endpoint )
122130 end
123131
124132 ### SNAPSHOTS
0 commit comments