@@ -66,7 +66,7 @@ def test_bulk_actions_remain_unchanged(sync_client):
66
66
def test_bulk_all_documents_get_inserted (sync_client ):
67
67
docs = [{"answer" : x , "_id" : x } for x in range (100 )]
68
68
for ok , item in helpers .streaming_bulk (
69
- sync_client , docs , index = "test-index" , refresh = True
69
+ sync_client , docs , index = "test-index"
70
70
):
71
71
assert ok
72
72
@@ -79,7 +79,6 @@ def test_bulk_all_errors_from_chunk_are_raised_on_failure(sync_client):
79
79
index = "i" ,
80
80
body = {
81
81
"mappings" : {"properties" : {"a" : {"type" : "integer" }}},
82
- "settings" : {"number_of_shards" : 1 , "number_of_replicas" : 0 },
83
82
},
84
83
)
85
84
sync_client .cluster .health (wait_for_status = "yellow" )
@@ -177,7 +176,6 @@ def test_bulk_rejected_documents_are_retried(sync_client):
177
176
assert 3 == len (results )
178
177
print (results )
179
178
assert [True , True , True ] == [r [0 ] for r in results ]
180
- sync_client .indices .refresh (index = "i" )
181
179
res = sync_client .search (index = "i" )
182
180
assert {"value" : 3 , "relation" : "eq" } == res ["hits" ]["total" ]
183
181
assert 4 == failing_client ._called
@@ -215,7 +213,6 @@ def test_bulk_rejected_documents_are_retried_when_bytes_or_string(
215
213
)
216
214
assert 3 == len (results )
217
215
assert [True , True , True ] == [r [0 ] for r in results ]
218
- sync_client .indices .refresh (index = "i" )
219
216
res = sync_client .search (index = "i" )
220
217
assert {"value" : 3 , "relation" : "eq" } == res ["hits" ]["total" ]
221
218
assert 4 == failing_client ._called
@@ -252,7 +249,6 @@ def test_bulk_rejected_documents_are_retried_at_most_max_retries_times(sync_clie
252
249
)
253
250
assert 3 == len (results )
254
251
assert [False , True , True ] == [r [0 ] for r in results ]
255
- sync_client .indices .refresh (index = "i" )
256
252
res = sync_client .search (index = "i" )
257
253
assert {"value" : 2 , "relation" : "eq" } == res ["hits" ]["total" ]
258
254
assert 4 == failing_client ._called
@@ -290,7 +286,7 @@ def streaming_bulk():
290
286
291
287
def test_bulk_works_with_single_item (sync_client ):
292
288
docs = [{"answer" : 42 , "_id" : 1 }]
293
- success , failed = helpers .bulk (sync_client , docs , index = "test-index" , refresh = True )
289
+ success , failed = helpers .bulk (sync_client , docs , index = "test-index" )
294
290
295
291
assert 1 == success
296
292
assert not failed
@@ -300,7 +296,7 @@ def test_bulk_works_with_single_item(sync_client):
300
296
301
297
def test_all_documents_get_inserted (sync_client ):
302
298
docs = [{"answer" : x , "_id" : x } for x in range (100 )]
303
- success , failed = helpers .bulk (sync_client , docs , index = "test-index" , refresh = True )
299
+ success , failed = helpers .bulk (sync_client , docs , index = "test-index" )
304
300
305
301
assert 100 == success
306
302
assert not failed
@@ -311,7 +307,7 @@ def test_all_documents_get_inserted(sync_client):
311
307
def test_stats_only_reports_numbers (sync_client ):
312
308
docs = [{"answer" : x } for x in range (100 )]
313
309
success , failed = helpers .bulk (
314
- sync_client , docs , index = "test-index" , refresh = True , stats_only = True
310
+ sync_client , docs , index = "test-index" , stats_only = True
315
311
)
316
312
317
313
assert 100 == success
@@ -323,7 +319,6 @@ def test_errors_are_reported_correctly(sync_client):
323
319
sync_client .indices .create (
324
320
index = "i" ,
325
321
mappings = {"properties" : {"a" : {"type" : "integer" }}},
326
- settings = {"number_of_shards" : 1 , "number_of_replicas" : 0 },
327
322
)
328
323
sync_client .cluster .health (wait_for_status = "yellow" )
329
324
@@ -348,7 +343,6 @@ def test_error_is_raised(sync_client):
348
343
sync_client .indices .create (
349
344
index = "i" ,
350
345
mappings = {"properties" : {"a" : {"type" : "integer" }}},
351
- settings = {"number_of_shards" : 1 , "number_of_replicas" : 0 },
352
346
)
353
347
sync_client .cluster .health (wait_for_status = "yellow" )
354
348
@@ -395,7 +389,6 @@ def test_errors_are_collected_properly(sync_client):
395
389
sync_client .indices .create (
396
390
index = "i" ,
397
391
mappings = {"properties" : {"a" : {"type" : "integer" }}},
398
- settings = {"number_of_shards" : 1 , "number_of_replicas" : 0 },
399
392
)
400
393
sync_client .cluster .health (wait_for_status = "yellow" )
401
394
@@ -442,7 +435,7 @@ def test_order_can_be_preserved(sync_client):
442
435
for x in range (100 ):
443
436
bulk .append ({"index" : {"_index" : "test_index" , "_id" : x }})
444
437
bulk .append ({"answer" : x , "correct" : x == 42 })
445
- sync_client .bulk (operations = bulk , refresh = True )
438
+ sync_client .bulk (operations = bulk )
446
439
447
440
docs = list (
448
441
helpers .scan (
@@ -464,7 +457,7 @@ def test_all_documents_are_read(sync_client):
464
457
for x in range (100 ):
465
458
bulk .append ({"index" : {"_index" : "test_index" , "_id" : x }})
466
459
bulk .append ({"answer" : x , "correct" : x == 42 })
467
- sync_client .bulk (operations = bulk , refresh = True )
460
+ sync_client .bulk (operations = bulk )
468
461
469
462
docs = list (helpers .scan (sync_client , index = "test_index" , size = 2 ))
470
463
@@ -479,7 +472,7 @@ def test_scroll_error(sync_client):
479
472
for x in range (4 ):
480
473
bulk .append ({"index" : {"_index" : "test_index" }})
481
474
bulk .append ({"value" : x })
482
- sync_client .bulk (operations = bulk , refresh = True )
475
+ sync_client .bulk (operations = bulk )
483
476
484
477
with patch .object (sync_client , "options" , return_value = sync_client ), patch .object (
485
478
sync_client , "scroll"
@@ -699,7 +692,7 @@ def test_log_warning_on_shard_failures(sync_client):
699
692
for x in range (4 ):
700
693
bulk .append ({"index" : {"_index" : "test_index" }})
701
694
bulk .append ({"value" : x })
702
- sync_client .bulk (operations = bulk , refresh = True )
695
+ sync_client .bulk (operations = bulk )
703
696
704
697
with patch (
705
698
"elasticsearch_serverless.helpers.actions.logger"
@@ -741,7 +734,7 @@ def test_clear_scroll(sync_client):
741
734
for x in range (4 ):
742
735
bulk .append ({"index" : {"_index" : "test_index" }})
743
736
bulk .append ({"value" : x })
744
- sync_client .bulk (operations = bulk , refresh = True )
737
+ sync_client .bulk (operations = bulk )
745
738
746
739
with patch .object (sync_client , "options" , return_value = sync_client ), patch .object (
747
740
sync_client , "clear_scroll" , wraps = sync_client .clear_scroll
@@ -840,7 +833,7 @@ def reindex_setup(sync_client):
840
833
"type" : "answers" if x % 2 == 0 else "questions" ,
841
834
}
842
835
)
843
- sync_client .bulk (operations = bulk , refresh = True )
836
+ sync_client .bulk (operations = bulk )
844
837
845
838
846
839
@pytest .mark .usefixtures ("reindex_setup" )
@@ -850,7 +843,6 @@ def test_reindex_passes_kwargs_to_scan_and_bulk(sync_client):
850
843
"test_index" ,
851
844
"prod_index" ,
852
845
scan_kwargs = {"q" : "type:answers" },
853
- bulk_kwargs = {"refresh" : True },
854
846
)
855
847
856
848
assert sync_client .indices .exists (index = "prod_index" )
@@ -869,7 +861,6 @@ def test_reindex_accepts_a_query(sync_client):
869
861
"prod_index" ,
870
862
query = {"query" : {"bool" : {"filter" : {"term" : {"type" : "answers" }}}}},
871
863
)
872
- sync_client .indices .refresh ()
873
864
874
865
assert sync_client .indices .exists (index = "prod_index" )
875
866
assert 50 == sync_client .count (index = "prod_index" , q = "type:answers" )["count" ]
@@ -882,7 +873,6 @@ def test_reindex_accepts_a_query(sync_client):
882
873
@pytest .mark .usefixtures ("reindex_setup" )
883
874
def test_all_documents_get_moved (sync_client ):
884
875
helpers .reindex (sync_client , "test_index" , "prod_index" )
885
- sync_client .indices .refresh ()
886
876
887
877
assert sync_client .indices .exists (index = "prod_index" )
888
878
assert 50 == sync_client .count (index = "prod_index" , q = "type:questions" )["count" ]
@@ -896,7 +886,6 @@ def test_all_documents_get_moved(sync_client):
896
886
@pytest .fixture (scope = "function" )
897
887
def parent_child_reindex_setup (sync_client ):
898
888
body = {
899
- "settings" : {"number_of_shards" : 1 , "number_of_replicas" : 0 },
900
889
"mappings" : {
901
890
"properties" : {
902
891
"question_answer" : {
@@ -916,7 +905,6 @@ def parent_child_reindex_setup(sync_client):
916
905
routing = 42 ,
917
906
body = {"some" : "data" , "question_answer" : {"name" : "answer" , "parent" : 42 }},
918
907
)
919
- sync_client .indices .refresh (index = "test-index" )
920
908
921
909
922
910
@pytest .mark .usefixtures ("parent_child_reindex_setup" )
@@ -963,7 +951,7 @@ def reindex_data_stream_setup(sync_client):
963
951
"@timestamp" : (dt - timedelta (days = x )).isoformat (),
964
952
}
965
953
)
966
- sync_client .bulk (operations = bulk , refresh = True )
954
+ sync_client .bulk (operations = bulk )
967
955
sync_client .indices .put_index_template (
968
956
name = "my-index-template" ,
969
957
body = {
@@ -972,7 +960,6 @@ def reindex_data_stream_setup(sync_client):
972
960
},
973
961
)
974
962
sync_client .indices .create_data_stream (name = "py-test-stream" )
975
- sync_client .indices .refresh ()
976
963
977
964
978
965
@pytest .mark .usefixtures ("reindex_data_stream_setup" )
@@ -985,7 +972,6 @@ def test_reindex_index_datastream(op_type, sync_client):
985
972
query = {"query" : {"bool" : {"filter" : {"term" : {"type" : "answers" }}}}},
986
973
op_type = op_type ,
987
974
)
988
- sync_client .indices .refresh ()
989
975
assert sync_client .indices .exists (index = "py-test-stream" )
990
976
assert 50 == sync_client .count (index = "py-test-stream" , q = "type:answers" )["count" ]
991
977
0 commit comments