@@ -73,15 +73,15 @@ class TestStreamingBulk:
7373 async def test_actions_remain_unchanged (self , async_client : Any ) -> None :
7474 actions1 = [{"_id" : 1 }, {"_id" : 2 }]
7575 async for ok , _ in actions .async_streaming_bulk (
76- async_client , actions1 , index = "test-index"
76+ client = async_client , actions = actions1 , index = "test-index"
7777 ):
7878 assert ok
7979 assert [{"_id" : 1 }, {"_id" : 2 }] == actions1
8080
8181 async def test_all_documents_get_inserted (self , async_client : Any ) -> None :
8282 docs = [{"answer" : x , "_id" : x } for x in range (100 )]
8383 async for ok , _ in actions .async_streaming_bulk (
84- async_client , docs , index = "test-index" , refresh = True
84+ client = async_client , actions = docs , index = "test-index" , refresh = True
8585 ):
8686 assert ok
8787
@@ -128,8 +128,8 @@ async def test_all_errors_from_chunk_are_raised_on_failure(
128128 self , async_client : Any
129129 ) -> None :
130130 await async_client .indices .create (
131- "i" ,
132- {
131+ index = "i" ,
132+ body = {
133133 "mappings" : {"properties" : {"a" : {"type" : "integer" }}},
134134 "settings" : {"number_of_shards" : 1 , "number_of_replicas" : 0 },
135135 },
@@ -154,7 +154,7 @@ async def test_different_op_types(self, async_client: Any) -> None:
154154 {"_op_type" : "delete" , "_index" : "i" , "_id" : 45 },
155155 {"_op_type" : "update" , "_index" : "i" , "_id" : 42 , "doc" : {"answer" : 42 }},
156156 ]
157- async for ok , _ in actions .async_streaming_bulk (async_client , docs ):
157+ async for ok , _ in actions .async_streaming_bulk (client = async_client , actions = docs ):
158158 assert ok
159159
160160 assert not await async_client .exists (index = "i" , id = 45 )
@@ -172,8 +172,8 @@ async def test_transport_error_can_becaught(self, async_client: Any) -> None:
172172 results = [
173173 x
174174 async for x in actions .async_streaming_bulk (
175- failing_client ,
176- docs ,
175+ client = failing_client ,
176+ actions = docs ,
177177 raise_on_exception = False ,
178178 raise_on_error = False ,
179179 chunk_size = 1 ,
@@ -207,8 +207,8 @@ async def test_rejected_documents_are_retried(self, async_client: Any) -> None:
207207 results = [
208208 x
209209 async for x in actions .async_streaming_bulk (
210- failing_client ,
211- docs ,
210+ client = failing_client ,
211+ actions = docs ,
212212 raise_on_exception = False ,
213213 raise_on_error = False ,
214214 chunk_size = 1 ,
@@ -238,8 +238,8 @@ async def test_rejected_documents_are_retried_at_most_max_retries_times(
238238 results = [
239239 x
240240 async for x in actions .async_streaming_bulk (
241- failing_client ,
242- docs ,
241+ client = failing_client ,
242+ actions = docs ,
243243 raise_on_exception = False ,
244244 raise_on_error = False ,
245245 chunk_size = 1 ,
@@ -285,7 +285,7 @@ class TestBulk:
285285 async def test_bulk_works_with_single_item (self , async_client : Any ) -> None :
286286 docs = [{"answer" : 42 , "_id" : 1 }]
287287 success , failed = await actions .async_bulk (
288- async_client , docs , index = "test-index" , refresh = True
288+ client = async_client , actions = docs , index = "test-index" , refresh = True
289289 )
290290
291291 assert 1 == success
@@ -298,7 +298,7 @@ async def test_bulk_works_with_single_item(self, async_client: Any) -> None:
298298 async def test_all_documents_get_inserted (self , async_client : Any ) -> None :
299299 docs = [{"answer" : x , "_id" : x } for x in range (100 )]
300300 success , failed = await actions .async_bulk (
301- async_client , docs , index = "test-index" , refresh = True
301+ client = async_client , actions = docs , index = "test-index" , refresh = True
302302 )
303303
304304 assert 100 == success
@@ -311,7 +311,7 @@ async def test_all_documents_get_inserted(self, async_client: Any) -> None:
311311 async def test_stats_only_reports_numbers (self , async_client : Any ) -> None :
312312 docs = [{"answer" : x } for x in range (100 )]
313313 success , failed = await actions .async_bulk (
314- async_client , docs , index = "test-index" , refresh = True , stats_only = True
314+ client = async_client , actions = docs , index = "test-index" , refresh = True , stats_only = True
315315 )
316316
317317 assert 100 == success
@@ -320,8 +320,8 @@ async def test_stats_only_reports_numbers(self, async_client: Any) -> None:
320320
321321 async def test_errors_are_reported_correctly (self , async_client : Any ) -> None :
322322 await async_client .indices .create (
323- "i" ,
324- {
323+ index = "i" ,
324+ body = {
325325 "mappings" : {"properties" : {"a" : {"type" : "integer" }}},
326326 "settings" : {"number_of_shards" : 1 , "number_of_replicas" : 0 },
327327 },
@@ -347,8 +347,8 @@ async def test_errors_are_reported_correctly(self, async_client: Any) -> None:
347347
348348 async def test_error_is_raised (self , async_client : Any ) -> None :
349349 await async_client .indices .create (
350- "i" ,
351- {
350+ index = "i" ,
351+ body = {
352352 "mappings" : {"properties" : {"a" : {"type" : "integer" }}},
353353 "settings" : {"number_of_shards" : 1 , "number_of_replicas" : 0 },
354354 },
@@ -361,7 +361,7 @@ async def test_error_is_raised(self, async_client: Any) -> None:
361361 async def test_ignore_error_if_raised (self , async_client : Any ) -> None :
362362 # ignore the status code 400 in tuple
363363 await actions .async_bulk (
364- async_client , [{"a" : 42 }, {"a" : "c" }], index = "i" , ignore_status = (400 ,)
364+ client = async_client , actions = [{"a" : 42 }, {"a" : "c" }], index = "i" , ignore_status = (400 ,)
365365 )
366366
367367 # ignore the status code 400 in list
@@ -393,8 +393,8 @@ async def test_ignore_error_if_raised(self, async_client: Any) -> None:
393393
394394 async def test_errors_are_collected_properly (self , async_client : Any ) -> None :
395395 await async_client .indices .create (
396- "i" ,
397- {
396+ index = "i" ,
397+ body = {
398398 "mappings" : {"properties" : {"a" : {"type" : "integer" }}},
399399 "settings" : {"number_of_shards" : 1 , "number_of_replicas" : 0 },
400400 },
@@ -461,7 +461,7 @@ async def test_order_can_be_preserved(
461461 for x in range (100 ):
462462 bulk .append ({"index" : {"_index" : "test_index" , "_id" : x }})
463463 bulk .append ({"answer" : x , "correct" : x == 42 })
464- await async_client .bulk (bulk , refresh = True )
464+ await async_client .bulk (body = bulk , refresh = True )
465465
466466 docs = [
467467 doc
@@ -484,7 +484,7 @@ async def test_all_documents_are_read(
484484 for x in range (100 ):
485485 bulk .append ({"index" : {"_index" : "test_index" , "_id" : x }})
486486 bulk .append ({"answer" : x , "correct" : x == 42 })
487- await async_client .bulk (bulk , refresh = True )
487+ await async_client .bulk (body = bulk , refresh = True )
488488
489489 docs = [
490490 x
@@ -500,7 +500,7 @@ async def test_scroll_error(self, async_client: Any, scan_teardown: Any) -> None
500500 for x in range (4 ):
501501 bulk .append ({"index" : {"_index" : "test_index" }})
502502 bulk .append ({"value" : x })
503- await async_client .bulk (bulk , refresh = True )
503+ await async_client .bulk (body = bulk , refresh = True )
504504
505505 with patch .object (async_client , "scroll" , MockScroll ()):
506506 data = [
@@ -608,7 +608,7 @@ async def test_logger(
608608 for x in range (4 ):
609609 bulk .append ({"index" : {"_index" : "test_index" }})
610610 bulk .append ({"value" : x })
611- await async_client .bulk (bulk , refresh = True )
611+ await async_client .bulk (body = bulk , refresh = True )
612612
613613 with patch .object (async_client , "scroll" , MockScroll ()):
614614 _ = [
@@ -649,7 +649,7 @@ async def test_clear_scroll(self, async_client: Any, scan_teardown: Any) -> None
649649 for x in range (4 ):
650650 bulk .append ({"index" : {"_index" : "test_index" }})
651651 bulk .append ({"value" : x })
652- await async_client .bulk (bulk , refresh = True )
652+ await async_client .bulk (body = bulk , refresh = True )
653653
654654 with patch .object (
655655 async_client , "clear_scroll" , wraps = async_client .clear_scroll
@@ -820,7 +820,7 @@ async def reindex_setup(async_client: Any) -> Any:
820820 "type" : "answers" if x % 2 == 0 else "questions" ,
821821 }
822822 )
823- await async_client .bulk (bulk , refresh = True )
823+ await async_client .bulk (body = bulk , refresh = True )
824824 yield
825825
826826
@@ -922,7 +922,7 @@ class TestParentChildReindex:
922922 async def test_children_are_reindexed_correctly (
923923 self , async_client : Any , parent_reindex_setup : Any
924924 ) -> None :
925- await actions .async_reindex (async_client , "test-index" , "real-index" )
925+ await actions .async_reindex (client = async_client , source_index = "test-index" , target_index = "real-index" )
926926 assert {"question_answer" : "question" } == (
927927 await async_client .get (index = "real-index" , id = 42 )
928928 )["_source" ]
0 commit comments