19
19
import static org .springframework .data .elasticsearch .annotations .FieldType .*;
20
20
import static org .springframework .data .elasticsearch .core .query .Query .*;
21
21
22
+ import org .springframework .data .elasticsearch .annotations .FieldType ;
22
23
import reactor .core .publisher .Flux ;
23
24
import reactor .core .publisher .Mono ;
24
25
import reactor .test .StepVerifier ;
@@ -91,7 +92,8 @@ void after() {
91
92
operations .indexOps (IndexCoordinates .of (INDEX )).delete ().block ();
92
93
}
93
94
94
- @ Test // DATAES-519
95
+ @ Test
96
+ // DATAES-519
95
97
void saveShouldSaveSingleEntity () {
96
98
97
99
repository .save (new SampleEntity ()) //
@@ -105,7 +107,8 @@ private Mono<Boolean> documentWithIdExistsInIndex(String id) {
105
107
return operations .exists (id , IndexCoordinates .of (INDEX ));
106
108
}
107
109
108
- @ Test // DATAES-519
110
+ @ Test
111
+ // DATAES-519
109
112
void saveShouldComputeMultipleEntities () {
110
113
111
114
repository .saveAll (Arrays .asList (new SampleEntity (), new SampleEntity (), new SampleEntity ()))
@@ -118,65 +121,71 @@ void saveShouldComputeMultipleEntities() {
118
121
.verifyComplete ();
119
122
}
120
123
121
- @ Test // DATAES-519, DATAES-767, DATAES-822
124
+ @ Test
125
+ // DATAES-519, DATAES-767, DATAES-822
122
126
void findByIdShouldErrorIfIndexDoesNotExist () {
123
127
repository .findById ("id-two" ) //
124
128
.as (StepVerifier ::create ) //
125
129
.expectError (RestStatusException .class );
126
130
}
127
131
128
- @ Test // DATAES-519
132
+ @ Test
133
+ // DATAES-519
129
134
void findShouldRetrieveSingleEntityById () {
130
135
131
136
bulkIndex (new SampleEntity ("id-one" ), //
132
137
new SampleEntity ("id-two" ), //
133
138
new SampleEntity ("id-three" )) //
134
- .block ();
139
+ .block ();
135
140
136
141
repository .findById ("id-two" ).as (StepVerifier ::create )//
137
142
.consumeNextWith (it -> assertThat (it .getId ()).isEqualTo ("id-two" )) //
138
143
.verifyComplete ();
139
144
}
140
145
141
- @ Test // DATAES-519
146
+ @ Test
147
+ // DATAES-519
142
148
void findByIdShouldCompleteIfNothingFound () {
143
149
144
150
bulkIndex (new SampleEntity ("id-one" ), //
145
151
new SampleEntity ("id-two" ), //
146
152
new SampleEntity ("id-three" )) //
147
- .block ();
153
+ .block ();
148
154
149
155
repository .findById ("does-not-exist" ).as (StepVerifier ::create ) //
150
156
.verifyComplete ();
151
157
}
152
158
153
- @ Test // DATAES-720
159
+ @ Test
160
+ // DATAES-720
154
161
void findAllShouldReturnAllElements () {
155
162
// make sure to be above the default page size of the Query interface
156
163
int count = DEFAULT_PAGE_SIZE * 2 ;
157
164
bulkIndex (IntStream .range (1 , count + 1 ) //
158
165
.mapToObj (it -> new SampleEntity (String .valueOf (it ))) //
159
166
.toArray (SampleEntity []::new )) //
160
- .block ();
167
+ .block ();
161
168
162
169
repository .findAll () //
163
170
.as (StepVerifier ::create ) //
164
171
.expectNextCount (count ) //
165
172
.verifyComplete ();
166
173
}
167
174
168
- @ Test // DATAES-519
175
+ @ Test
176
+ // DATAES-519
169
177
void findAllByIdByIdShouldCompleteIfIndexDoesNotExist () {
170
178
repository .findAllById (Arrays .asList ("id-two" , "id-two" )).as (StepVerifier ::create ).verifyComplete ();
171
179
}
172
180
173
- @ Test // DATAES-519
181
+ @ Test
182
+ // DATAES-519
174
183
void findAllByIdShouldRetrieveMatchingDocuments () {
175
184
176
185
bulkIndex (new SampleEntity ("id-one" ), //
177
186
new SampleEntity ("id-two" ), //
178
187
new SampleEntity ("id-three" )) //
179
- .block ();
188
+ .block ();
180
189
181
190
repository .findAllById (Arrays .asList ("id-one" , "id-two" )) //
182
191
.as (StepVerifier ::create )//
@@ -185,26 +194,28 @@ void findAllByIdShouldRetrieveMatchingDocuments() {
185
194
.verifyComplete ();
186
195
}
187
196
188
- @ Test // DATAES-519
197
+ @ Test
198
+ // DATAES-519
189
199
void findAllByIdShouldCompleteWhenNothingFound () {
190
200
191
201
bulkIndex (new SampleEntity ("id-one" ), //
192
202
new SampleEntity ("id-two" ), //
193
203
new SampleEntity ("id-three" )) //
194
- .block ();
204
+ .block ();
195
205
196
206
repository .findAllById (Arrays .asList ("can't" , "touch" , "this" )) //
197
207
.as (StepVerifier ::create )//
198
208
.verifyComplete ();
199
209
}
200
210
201
- @ Test // DATAES-717
211
+ @ Test
212
+ // DATAES-717
202
213
void shouldReturnFluxOfSearchHit () {
203
214
204
215
bulkIndex (new SampleEntity ("id-one" , "message" ), //
205
216
new SampleEntity ("id-two" , "message" ), //
206
217
new SampleEntity ("id-three" , "message" )) //
207
- .block ();
218
+ .block ();
208
219
209
220
repository .queryAllByMessage ("message" ) //
210
221
.as (StepVerifier ::create ) //
@@ -213,13 +224,14 @@ void shouldReturnFluxOfSearchHit() {
213
224
.verifyComplete ();
214
225
}
215
226
216
- @ Test // DATAES-717
227
+ @ Test
228
+ // DATAES-717
217
229
void shouldReturnFluxOfSearchHitForStringQuery () {
218
230
219
231
bulkIndex (new SampleEntity ("id-one" , "message" ), //
220
232
new SampleEntity ("id-two" , "message" ), //
221
233
new SampleEntity ("id-three" , "message" )) //
222
- .block ();
234
+ .block ();
223
235
224
236
repository .queryByMessageWithString ("message" ) //
225
237
.as (StepVerifier ::create ) //
@@ -228,13 +240,14 @@ void shouldReturnFluxOfSearchHitForStringQuery() {
228
240
.verifyComplete ();
229
241
}
230
242
231
- @ Test // DATAES-372
243
+ @ Test
244
+ // DATAES-372
232
245
void shouldReturnHighlightsOnAnnotatedMethod () {
233
246
234
247
bulkIndex (new SampleEntity ("id-one" , "message" ), //
235
248
new SampleEntity ("id-two" , "message" ), //
236
249
new SampleEntity ("id-three" , "message" )) //
237
- .block ();
250
+ .block ();
238
251
239
252
repository .queryAllByMessage ("message" ) //
240
253
.as (StepVerifier ::create ) //
@@ -246,13 +259,14 @@ void shouldReturnHighlightsOnAnnotatedMethod() {
246
259
.verifyComplete ();
247
260
}
248
261
249
- @ Test // DATAES-372
262
+ @ Test
263
+ // DATAES-372
250
264
void shouldReturnHighlightsOnAnnotatedStringQueryMethod () {
251
265
252
266
bulkIndex (new SampleEntity ("id-one" , "message" ), //
253
267
new SampleEntity ("id-two" , "message" ), //
254
268
new SampleEntity ("id-three" , "message" )) //
255
- .block ();
269
+ .block ();
256
270
257
271
repository .queryByMessageWithString ("message" ) //
258
272
.as (StepVerifier ::create ) //
@@ -264,52 +278,57 @@ void shouldReturnHighlightsOnAnnotatedStringQueryMethod() {
264
278
.verifyComplete ();
265
279
}
266
280
267
- @ Test // DATAES-519, DATAES-767, DATAES-822
281
+ @ Test
282
+ // DATAES-519, DATAES-767, DATAES-822
268
283
void countShouldErrorWhenIndexDoesNotExist () {
269
284
repository .count () //
270
285
.as (StepVerifier ::create ) //
271
286
.expectError (RestStatusException .class );
272
287
}
273
288
274
- @ Test // DATAES-519
289
+ @ Test
290
+ // DATAES-519
275
291
void countShouldCountDocuments () {
276
292
277
293
bulkIndex (new SampleEntity ("id-one" ), //
278
294
new SampleEntity ("id-two" )) //
279
- .block ();
295
+ .block ();
280
296
281
297
repository .count ().as (StepVerifier ::create ).expectNext (2L ).verifyComplete ();
282
298
}
283
299
284
- @ Test // DATAES-519
300
+ @ Test
301
+ // DATAES-519
285
302
void existsByIdShouldReturnTrueIfExists () {
286
303
287
304
bulkIndex (new SampleEntity ("id-one" , "message" ), //
288
305
new SampleEntity ("id-two" , "test message" ), //
289
306
new SampleEntity ("id-three" , "test test" )) //
290
- .block ();
307
+ .block ();
291
308
292
309
repository .existsById ("id-two" ) //
293
310
.as (StepVerifier ::create ) //
294
311
.expectNext (true ) //
295
312
.verifyComplete ();
296
313
}
297
314
298
- @ Test // DATAES-519
315
+ @ Test
316
+ // DATAES-519
299
317
void existsByIdShouldReturnFalseIfNotExists () {
300
318
301
319
bulkIndex (new SampleEntity ("id-one" , "message" ), //
302
320
new SampleEntity ("id-two" , "test message" ), //
303
321
new SampleEntity ("id-three" , "test test" )) //
304
- .block ();
322
+ .block ();
305
323
306
324
repository .existsById ("wrecking ball" ) //
307
325
.as (StepVerifier ::create ) //
308
326
.expectNext (false ) //
309
327
.verifyComplete ();
310
328
}
311
329
312
- @ Test // DATAES-519
330
+ @ Test
331
+ // DATAES-519
313
332
void countShouldCountMatchingDocuments () {
314
333
315
334
bulkIndex (new SampleEntity ("id-one" , "message" ), //
@@ -336,52 +355,57 @@ void shouldCountWithStringQuery() {
336
355
.verifyComplete ();
337
356
}
338
357
339
- @ Test // DATAES-519
358
+ @ Test
359
+ // DATAES-519
340
360
void existsShouldReturnTrueIfExists () {
341
361
342
362
bulkIndex (new SampleEntity ("id-one" , "message" ), //
343
363
new SampleEntity ("id-two" , "test message" ), //
344
364
new SampleEntity ("id-three" , "test test" )) //
345
- .block ();
365
+ .block ();
346
366
347
367
repository .existsAllByMessage ("message" ) //
348
368
.as (StepVerifier ::create ) //
349
369
.expectNext (true ) //
350
370
.verifyComplete ();
351
371
}
352
372
353
- @ Test // DATAES-519
373
+ @ Test
374
+ // DATAES-519
354
375
void existsShouldReturnFalseIfNotExists () {
355
376
356
377
bulkIndex (new SampleEntity ("id-one" , "message" ), //
357
378
new SampleEntity ("id-two" , "test message" ), //
358
379
new SampleEntity ("id-three" , "test test" )) //
359
- .block ();
380
+ .block ();
360
381
361
382
repository .existsAllByMessage ("these days" ) //
362
383
.as (StepVerifier ::create ) //
363
384
.expectNext (false ) //
364
385
.verifyComplete ();
365
386
}
366
387
367
- @ Test // DATAES-519
388
+ @ Test
389
+ // DATAES-519
368
390
void deleteByIdShouldCompleteIfNothingDeleted () {
369
391
370
392
bulkIndex (new SampleEntity ("id-one" ), //
371
393
new SampleEntity ("id-two" )) //
372
- .block ();
394
+ .block ();
373
395
374
396
repository .deleteById ("does-not-exist" ).as (StepVerifier ::create ).verifyComplete ();
375
397
}
376
398
377
- @ Test // DATAES-519, DATAES-767, DATAES-822, DATAES-678
399
+ @ Test
400
+ // DATAES-519, DATAES-767, DATAES-822, DATAES-678
378
401
void deleteByIdShouldCompleteWhenIndexDoesNotExist () {
379
402
repository .deleteById ("does-not-exist" ) //
380
403
.as (StepVerifier ::create ) //
381
404
.verifyComplete ();
382
405
}
383
406
384
- @ Test // DATAES-519
407
+ @ Test
408
+ // DATAES-519
385
409
void deleteByIdShouldDeleteEntry () {
386
410
387
411
SampleEntity toBeDeleted = new SampleEntity ("id-two" );
@@ -393,19 +417,22 @@ void deleteByIdShouldDeleteEntry() {
393
417
assertThat (documentWithIdExistsInIndex (toBeDeleted .getId ()).block ()).isFalse ();
394
418
}
395
419
396
- @ Test // DATAES-976
420
+ @ Test
421
+ // DATAES-976
397
422
void deleteAllByIdShouldDeleteEntry () {
398
423
399
424
SampleEntity toBeDeleted = new SampleEntity ("id-two" );
400
425
bulkIndex (new SampleEntity ("id-one" ), toBeDeleted ) //
401
426
.block ();
402
427
403
- repository .deleteAllById (Collections .singletonList (toBeDeleted .getId ())).as (StepVerifier ::create ).verifyComplete ();
428
+ repository .deleteAllById (Collections .singletonList (toBeDeleted .getId ())).as (StepVerifier ::create )
429
+ .verifyComplete ();
404
430
405
431
assertThat (documentWithIdExistsInIndex (toBeDeleted .getId ()).block ()).isFalse ();
406
432
}
407
433
408
- @ Test // DATAES-519
434
+ @ Test
435
+ // DATAES-519
409
436
void deleteShouldDeleteEntry () {
410
437
411
438
SampleEntity toBeDeleted = new SampleEntity ("id-two" );
@@ -417,7 +444,8 @@ void deleteShouldDeleteEntry() {
417
444
assertThat (documentWithIdExistsInIndex (toBeDeleted .getId ()).block ()).isFalse ();
418
445
}
419
446
420
- @ Test // DATAES-519
447
+ @ Test
448
+ // DATAES-519
421
449
void deleteAllShouldDeleteGivenEntries () {
422
450
423
451
SampleEntity toBeDeleted = new SampleEntity ("id-one" );
@@ -434,13 +462,14 @@ void deleteAllShouldDeleteGivenEntries() {
434
462
assertThat (documentWithIdExistsInIndex (hangInThere .getId ()).block ()).isTrue ();
435
463
}
436
464
437
- @ Test // DATAES-519
465
+ @ Test
466
+ // DATAES-519
438
467
void deleteAllShouldDeleteAllEntries () {
439
468
440
469
bulkIndex (new SampleEntity ("id-one" ), //
441
470
new SampleEntity ("id-two" ), //
442
471
new SampleEntity ("id-three" )) //
443
- .block ();
472
+ .block ();
444
473
445
474
repository .deleteAll ().as (StepVerifier ::create ).verifyComplete ();
446
475
@@ -450,41 +479,44 @@ void deleteAllShouldDeleteAllEntries() {
450
479
.verifyComplete ();
451
480
}
452
481
453
- @ Test // DATAES-519
482
+ @ Test
483
+ // DATAES-519
454
484
void derivedFinderMethodShouldBeExecutedCorrectly () {
455
485
456
486
bulkIndex (new SampleEntity ("id-one" , "message" ), //
457
487
new SampleEntity ("id-two" , "test message" ), //
458
488
new SampleEntity ("id-three" , "test test" )) //
459
- .block ();
489
+ .block ();
460
490
461
491
repository .findAllByMessageLike ("test" ) //
462
492
.as (StepVerifier ::create ) //
463
493
.expectNextCount (2 ) //
464
494
.verifyComplete ();
465
495
}
466
496
467
- @ Test // DATAES-519
497
+ @ Test
498
+ // DATAES-519
468
499
void derivedFinderMethodShouldBeExecutedCorrectlyWhenGivenPublisher () {
469
500
470
501
bulkIndex (new SampleEntity ("id-one" , "message" ), //
471
502
new SampleEntity ("id-two" , "test message" ), //
472
503
new SampleEntity ("id-three" , "test test" )) //
473
- .block ();
504
+ .block ();
474
505
475
506
repository .findAllByMessage (Mono .just ("test" )) //
476
507
.as (StepVerifier ::create ) //
477
508
.expectNextCount (2 ) //
478
509
.verifyComplete ();
479
510
}
480
511
481
- @ Test // DATAES-519
512
+ @ Test
513
+ // DATAES-519
482
514
void derivedFinderWithDerivedSortMethodShouldBeExecutedCorrectly () {
483
515
484
516
bulkIndex (new SampleEntity ("id-one" , "test" , 3 ), //
485
517
new SampleEntity ("id-two" , "test test" , 1 ), //
486
518
new SampleEntity ("id-three" , "test test" , 2 )) //
487
- .block ();
519
+ .block ();
488
520
489
521
repository .findAllByMessageLikeOrderByRate ("test" ) //
490
522
.as (StepVerifier ::create ) //
@@ -494,13 +526,14 @@ void derivedFinderWithDerivedSortMethodShouldBeExecutedCorrectly() {
494
526
.verifyComplete ();
495
527
}
496
528
497
- @ Test // DATAES-519
529
+ @ Test
530
+ // DATAES-519
498
531
void derivedFinderMethodWithSortParameterShouldBeExecutedCorrectly () {
499
532
500
533
bulkIndex (new SampleEntity ("id-one" , "test" , 3 ), //
501
534
new SampleEntity ("id-two" , "test test" , 1 ), //
502
535
new SampleEntity ("id-three" , "test test" , 2 )) //
503
- .block ();
536
+ .block ();
504
537
505
538
repository .findAllByMessage ("test" , Sort .by (Order .asc ("rate" ))) //
506
539
.as (StepVerifier ::create ) //
@@ -510,13 +543,14 @@ void derivedFinderMethodWithSortParameterShouldBeExecutedCorrectly() {
510
543
.verifyComplete ();
511
544
}
512
545
513
- @ Test // DATAES-519
546
+ @ Test
547
+ // DATAES-519
514
548
void derivedFinderMethodWithPageableParameterShouldBeExecutedCorrectly () {
515
549
516
550
bulkIndex (new SampleEntity ("id-one" , "test" , 3 ), //
517
551
new SampleEntity ("id-two" , "test test" , 1 ), //
518
552
new SampleEntity ("id-three" , "test test" , 2 )) //
519
- .block ();
553
+ .block ();
520
554
521
555
repository .findAllByMessage ("test" , PageRequest .of (0 , 2 , Sort .by (Order .asc ("rate" )))) //
522
556
.as (StepVerifier ::create ) //
@@ -525,21 +559,23 @@ void derivedFinderMethodWithPageableParameterShouldBeExecutedCorrectly() {
525
559
.verifyComplete ();
526
560
}
527
561
528
- @ Test // DATAES-519
562
+ @ Test
563
+ // DATAES-519
529
564
void derivedFinderMethodReturningMonoShouldBeExecutedCorrectly () {
530
565
531
566
bulkIndex (new SampleEntity ("id-one" , "message" ), //
532
567
new SampleEntity ("id-two" , "test message" ), //
533
568
new SampleEntity ("id-three" , "test test" )) //
534
- .block ();
569
+ .block ();
535
570
536
571
repository .findFirstByMessageLike ("test" ) //
537
572
.as (StepVerifier ::create ) //
538
573
.expectNextCount (1 ) //
539
574
.verifyComplete ();
540
575
}
541
576
542
- @ Test // DATAES-519
577
+ @ Test
578
+ // DATAES-519
543
579
void annotatedFinderMethodShouldBeExecutedCorrectly () {
544
580
545
581
int count = 30 ;
@@ -555,7 +591,8 @@ void annotatedFinderMethodShouldBeExecutedCorrectly() {
555
591
.verifyComplete ();
556
592
}
557
593
558
- @ Test // #1917
594
+ @ Test
595
+ // #1917
559
596
void annotatedFinderMethodPagedShouldBeExecutedCorrectly () {
560
597
561
598
int count = 30 ;
@@ -575,13 +612,14 @@ void annotatedFinderMethodPagedShouldBeExecutedCorrectly() {
575
612
.verifyComplete ();
576
613
}
577
614
578
- @ Test // DATAES-519
615
+ @ Test
616
+ // DATAES-519
579
617
void derivedDeleteMethodShouldBeExecutedCorrectly () {
580
618
581
619
bulkIndex (new SampleEntity ("id-one" , "message" ), //
582
620
new SampleEntity ("id-two" , "test message" ), //
583
621
new SampleEntity ("id-three" , "test test" )) //
584
- .block ();
622
+ .block ();
585
623
586
624
repository .deleteAllByMessage ("message" ) //
587
625
.as (StepVerifier ::create ) //
@@ -593,6 +631,56 @@ void derivedDeleteMethodShouldBeExecutedCorrectly() {
593
631
assertThat (documentWithIdExistsInIndex ("id-three" ).block ()).isTrue ();
594
632
}
595
633
634
+ @ Test
635
+ // #2135
636
+ void FluxOfSearchHitForArrayQuery () {
637
+ bulkIndex (new SampleEntity ("id-one" , "message1" ), //
638
+ new SampleEntity ("id-two" , "message2" ), //
639
+ new SampleEntity ("id-three" , "message3" )) //
640
+ .block ();
641
+
642
+ repository .findAllViaAnnotatedQueryByMessageIn (Arrays .asList ("message1" , "message3" )) //
643
+ .as (StepVerifier ::create ) //
644
+ .consumeNextWith (it -> assertThat (it .getId ()).isEqualTo ("id-one" )) //
645
+ .consumeNextWith (it -> assertThat (it .getId ()).isEqualTo ("id-three" )) //
646
+ .verifyComplete ();
647
+
648
+ }
649
+
650
+ @ Test
651
+ // #2135
652
+ void FluxOfSearchHitForIntegerArrayQuery () {
653
+ bulkIndex (new SampleEntity ("id-one" , "test" , 3 ), //
654
+ new SampleEntity ("id-two" , "test test" , 1 ), //
655
+ new SampleEntity ("id-three" , "test test" , 2 )) //
656
+ .block ();
657
+
658
+ repository .findAllViaAnnotatedQueryByRatesIn (Arrays .asList (2 , 3 )) //
659
+ .as (StepVerifier ::create ) //
660
+ .consumeNextWith (it -> assertThat (it .getId ()).isEqualTo ("id-one" )) //
661
+ .consumeNextWith (it -> assertThat (it .getId ()).isEqualTo ("id-three" )) //
662
+ .verifyComplete ();
663
+
664
+ }
665
+
666
+ @ Test
667
+ // #2135
668
+ void FluxOfSearchHitForStringAndIntegerArrayQuery () {
669
+ bulkIndex (new SampleEntity ("id-one" , "message1" , 1 ), //
670
+ new SampleEntity ("id-two" , "message2" , 2 ), //
671
+ new SampleEntity ("id-three" , "message3" , 3 ), //
672
+ new SampleEntity ("id-four" , "message4" , 4 ), //
673
+ new SampleEntity ("id-five" , "message5" , 5 )) //
674
+ .block ();
675
+
676
+ repository .findAllViaAnnotatedQueryByMessageInAndRatesIn (Arrays .asList ("message5" , "message3" ), Arrays .asList (2 ,
677
+ 3 )) //
678
+ .as (StepVerifier ::create ) //
679
+ .consumeNextWith (it -> assertThat (it .getId ()).isEqualTo ("id-three" )) //
680
+ .verifyComplete ();
681
+
682
+ }
683
+
596
684
Mono <Void > bulkIndex (SampleEntity ... entities ) {
597
685
return operations .saveAll (Arrays .asList (entities ), IndexCoordinates .of (INDEX )).then ();
598
686
}
@@ -609,11 +697,11 @@ interface ReactiveSampleEntityRepository extends ReactiveCrudRepository<SampleEn
609
697
610
698
Flux <SampleEntity > findAllByMessage (Publisher <String > message );
611
699
612
- @ Highlight (fields = { @ HighlightField (name = "message" ) })
700
+ @ Highlight (fields = {@ HighlightField (name = "message" )})
613
701
Flux <SearchHit <SampleEntity >> queryAllByMessage (String message );
614
702
615
703
@ Query ("{\" bool\" : {\" must\" : [{\" term\" : {\" message\" : \" ?0\" }}]}}" )
616
- @ Highlight (fields = { @ HighlightField (name = "message" ) })
704
+ @ Highlight (fields = {@ HighlightField (name = "message" )})
617
705
Flux <SearchHit <SampleEntity >> queryByMessageWithString (String message );
618
706
619
707
@ Query ("{ \" bool\" : { \" must\" : { \" term\" : { \" message\" : \" ?0\" } } } }" )
@@ -632,18 +720,39 @@ interface ReactiveSampleEntityRepository extends ReactiveCrudRepository<SampleEn
632
720
633
721
@ CountQuery (value = "{\" bool\" : {\" must\" : [{\" term\" : {\" message\" : \" ?0\" }}]}}" )
634
722
Mono <Long > retrieveCountByText (String message );
723
+
724
+ @ Query ("{ \" terms\" : { \" message\" : ?0 } }" )
725
+ Flux <SampleEntity > findAllViaAnnotatedQueryByMessageIn (List <String > messages );
726
+
727
+ @ Query ("{ \" terms\" : { \" rate\" : ?0 } }" )
728
+ Flux <SampleEntity > findAllViaAnnotatedQueryByRatesIn (List <Integer > rates );
729
+
730
+ @ Query ("{\" bool\" : {\" must\" : [{ \" terms\" : { \" message\" : ?0 } }, { \" terms\" : { \" rate\" : ?1 } }] } }" )
731
+ Flux <SampleEntity > findAllViaAnnotatedQueryByMessageInAndRatesIn (List <String > messages , List <Integer > rates );
732
+
635
733
}
636
734
637
735
@ Document (indexName = INDEX )
638
736
static class SampleEntity {
639
- @ Nullable @ Id private String id ;
640
- @ Nullable @ Field (type = Text , store = true , fielddata = true ) private String type ;
641
- @ Nullable @ Field (type = Text , store = true , fielddata = true ) private String message ;
642
- @ Nullable private int rate ;
643
- @ Nullable private boolean available ;
644
- @ Nullable @ Version private Long version ;
645
-
646
- public SampleEntity () {}
737
+ @ Nullable
738
+ @ Id
739
+ private String id ;
740
+ @ Nullable
741
+ @ Field (type = FieldType .Text , store = true , fielddata = true )
742
+ private String type ;
743
+ @ Nullable
744
+ @ Field (type = FieldType .Text , store = true , fielddata = true )
745
+ private String message ;
746
+ @ Nullable
747
+ private int rate ;
748
+ @ Nullable
749
+ private boolean available ;
750
+ @ Nullable
751
+ @ Version
752
+ private Long version ;
753
+
754
+ public SampleEntity () {
755
+ }
647
756
648
757
public SampleEntity (@ Nullable String id ) {
649
758
this .id = id ;
0 commit comments