@@ -150,6 +150,7 @@ public void testSimpleQueryString() throws ExecutionException, InterruptedExcept
150
150
client ().prepareIndex ("test" ).setId ("5" ).setSource ("body" , "quux baz spaghetti" ),
151
151
client ().prepareIndex ("test" ).setId ("6" ).setSource ("otherbody" , "spaghetti" )
152
152
);
153
+ indexRandomForConcurrentSearch ("test" );
153
154
154
155
SearchResponse searchResponse = client ().prepareSearch ().setQuery (simpleQueryStringQuery ("foo bar" )).get ();
155
156
assertHitCount (searchResponse , 3L );
@@ -199,6 +200,7 @@ public void testSimpleQueryStringMinimumShouldMatch() throws Exception {
199
200
client ().prepareIndex ("test" ).setId ("3" ).setSource ("body" , "foo bar" ),
200
201
client ().prepareIndex ("test" ).setId ("4" ).setSource ("body" , "foo baz bar" )
201
202
);
203
+ indexRandomForConcurrentSearch ("test" );
202
204
203
205
logger .info ("--> query 1" );
204
206
SearchResponse searchResponse = client ().prepareSearch ().setQuery (simpleQueryStringQuery ("foo bar" ).minimumShouldMatch ("2" )).get ();
@@ -235,6 +237,7 @@ public void testSimpleQueryStringMinimumShouldMatch() throws Exception {
235
237
client ().prepareIndex ("test" ).setId ("7" ).setSource ("body2" , "foo bar" , "other" , "foo" ),
236
238
client ().prepareIndex ("test" ).setId ("8" ).setSource ("body2" , "foo baz bar" , "other" , "foo" )
237
239
);
240
+ indexRandomForConcurrentSearch ("test" );
238
241
239
242
logger .info ("--> query 5" );
240
243
searchResponse = client ().prepareSearch ()
@@ -256,7 +259,7 @@ public void testSimpleQueryStringMinimumShouldMatch() throws Exception {
256
259
assertSearchHits (searchResponse , "6" , "7" , "8" );
257
260
}
258
261
259
- public void testNestedFieldSimpleQueryString () throws IOException {
262
+ public void testNestedFieldSimpleQueryString () throws Exception {
260
263
assertAcked (
261
264
prepareCreate ("test" ).setMapping (
262
265
jsonBuilder ().startObject ()
@@ -275,6 +278,7 @@ public void testNestedFieldSimpleQueryString() throws IOException {
275
278
);
276
279
client ().prepareIndex ("test" ).setId ("1" ).setSource ("body" , "foo bar baz" ).get ();
277
280
refresh ();
281
+ indexRandomForConcurrentSearch ("test" );
278
282
279
283
SearchResponse searchResponse = client ().prepareSearch ().setQuery (simpleQueryStringQuery ("foo bar baz" ).field ("body" )).get ();
280
284
assertHitCount (searchResponse , 1L );
@@ -359,6 +363,8 @@ public void testSimpleQueryStringLenient() throws ExecutionException, Interrupte
359
363
client ().prepareIndex ("test2" ).setId ("10" ).setSource ("field" , 5 )
360
364
);
361
365
refresh ();
366
+ indexRandomForConcurrentSearch ("test1" );
367
+ indexRandomForConcurrentSearch ("test2" );
362
368
363
369
SearchResponse searchResponse = client ().prepareSearch ()
364
370
.setAllowPartialSearchResults (true )
@@ -419,6 +425,7 @@ public void testSimpleQueryStringUsesFieldAnalyzer() throws Exception {
419
425
client ().prepareIndex ("test" ).setId ("2" ).setSource ("foo" , 234 , "bar" , "bcd" ).get ();
420
426
421
427
refresh ();
428
+ indexRandomForConcurrentSearch ("test" );
422
429
423
430
SearchResponse searchResponse = client ().prepareSearch ().setQuery (simpleQueryStringQuery ("123" ).field ("foo" ).field ("bar" )).get ();
424
431
assertHitCount (searchResponse , 1L );
@@ -469,6 +476,7 @@ public void testBasicAllQuery() throws Exception {
469
476
reqs .add (client ().prepareIndex ("test" ).setId ("2" ).setSource ("f2" , "Bar" ));
470
477
reqs .add (client ().prepareIndex ("test" ).setId ("3" ).setSource ("f3" , "foo bar baz" ));
471
478
indexRandom (true , false , reqs );
479
+ indexRandomForConcurrentSearch ("test" );
472
480
473
481
SearchResponse resp = client ().prepareSearch ("test" ).setQuery (simpleQueryStringQuery ("foo" )).get ();
474
482
assertHitCount (resp , 2L );
@@ -492,6 +500,7 @@ public void testWithDate() throws Exception {
492
500
reqs .add (client ().prepareIndex ("test" ).setId ("1" ).setSource ("f1" , "foo" , "f_date" , "2015/09/02" ));
493
501
reqs .add (client ().prepareIndex ("test" ).setId ("2" ).setSource ("f1" , "bar" , "f_date" , "2015/09/01" ));
494
502
indexRandom (true , false , reqs );
503
+ indexRandomForConcurrentSearch ("test" );
495
504
496
505
SearchResponse resp = client ().prepareSearch ("test" ).setQuery (simpleQueryStringQuery ("foo bar" )).get ();
497
506
assertHits (resp .getHits (), "1" , "2" );
@@ -523,6 +532,7 @@ public void testWithLotsOfTypes() throws Exception {
523
532
client ().prepareIndex ("test" ).setId ("2" ).setSource ("f1" , "bar" , "f_date" , "2015/09/01" , "f_float" , "1.8" , "f_ip" , "127.0.0.2" )
524
533
);
525
534
indexRandom (true , false , reqs );
535
+ indexRandomForConcurrentSearch ("test" );
526
536
527
537
SearchResponse resp = client ().prepareSearch ("test" ).setQuery (simpleQueryStringQuery ("foo bar" )).get ();
528
538
assertHits (resp .getHits (), "1" , "2" );
@@ -550,6 +560,7 @@ public void testDocWithAllTypes() throws Exception {
550
560
String docBody = copyToStringFromClasspath ("/org/opensearch/search/query/all-example-document.json" );
551
561
reqs .add (client ().prepareIndex ("test" ).setId ("1" ).setSource (docBody , MediaTypeRegistry .JSON ));
552
562
indexRandom (true , false , reqs );
563
+ indexRandomForConcurrentSearch ("test" );
553
564
554
565
SearchResponse resp = client ().prepareSearch ("test" ).setQuery (simpleQueryStringQuery ("foo" )).get ();
555
566
assertHits (resp .getHits (), "1" );
@@ -596,6 +607,7 @@ public void testKeywordWithWhitespace() throws Exception {
596
607
reqs .add (client ().prepareIndex ("test" ).setId ("2" ).setSource ("f1" , "bar" ));
597
608
reqs .add (client ().prepareIndex ("test" ).setId ("3" ).setSource ("f1" , "foo bar" ));
598
609
indexRandom (true , false , reqs );
610
+ indexRandomForConcurrentSearch ("test" );
599
611
600
612
SearchResponse resp = client ().prepareSearch ("test" ).setQuery (simpleQueryStringQuery ("foo" )).get ();
601
613
assertHits (resp .getHits (), "3" );
@@ -663,6 +675,7 @@ public void testFieldAlias() throws Exception {
663
675
indexRequests .add (client ().prepareIndex ("test" ).setId ("2" ).setSource ("f3" , "value" , "f2" , "two" ));
664
676
indexRequests .add (client ().prepareIndex ("test" ).setId ("3" ).setSource ("f3" , "another value" , "f2" , "three" ));
665
677
indexRandom (true , false , indexRequests );
678
+ indexRandomForConcurrentSearch ("test" );
666
679
667
680
SearchResponse response = client ().prepareSearch ("test" ).setQuery (simpleQueryStringQuery ("value" ).field ("f3_alias" )).get ();
668
681
@@ -681,6 +694,7 @@ public void testFieldAliasWithWildcardField() throws Exception {
681
694
indexRequests .add (client ().prepareIndex ("test" ).setId ("2" ).setSource ("f3" , "value" , "f2" , "two" ));
682
695
indexRequests .add (client ().prepareIndex ("test" ).setId ("3" ).setSource ("f3" , "another value" , "f2" , "three" ));
683
696
indexRandom (true , false , indexRequests );
697
+ indexRandomForConcurrentSearch ("test" );
684
698
685
699
SearchResponse response = client ().prepareSearch ("test" ).setQuery (simpleQueryStringQuery ("value" ).field ("f3_*" )).get ();
686
700
@@ -697,6 +711,7 @@ public void testFieldAliasOnDisallowedFieldType() throws Exception {
697
711
List <IndexRequestBuilder > indexRequests = new ArrayList <>();
698
712
indexRequests .add (client ().prepareIndex ("test" ).setId ("1" ).setSource ("f3" , "text" , "f2" , "one" ));
699
713
indexRandom (true , false , indexRequests );
714
+ indexRandomForConcurrentSearch ("test" );
700
715
701
716
// The wildcard field matches aliases for both a text and boolean field.
702
717
// By default, the boolean field should be ignored when building the query.
0 commit comments