-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHybridSearchRequest.java
2252 lines (1985 loc) · 69.2 KB
/
HybridSearchRequest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package opensearch;
import jakarta.json.stream.JsonGenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonData;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.JsonpSerializable;
import org.opensearch.client.json.ObjectBuilderDeserializer;
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.opensearch._types.ErrorResponse;
import org.opensearch.client.opensearch._types.ExpandWildcard;
import org.opensearch.client.opensearch._types.FieldValue;
import org.opensearch.client.opensearch._types.RequestBase;
import org.opensearch.client.opensearch._types.ScriptField;
import org.opensearch.client.opensearch._types.SearchType;
import org.opensearch.client.opensearch._types.SlicedScroll;
import org.opensearch.client.opensearch._types.SortOptions;
import org.opensearch.client.opensearch._types.Time;
import org.opensearch.client.opensearch._types.aggregations.Aggregation;
import org.opensearch.client.opensearch._types.mapping.RuntimeField;
import org.opensearch.client.opensearch._types.query_dsl.FieldAndFormat;
import org.opensearch.client.opensearch._types.query_dsl.Operator;
import org.opensearch.client.opensearch._types.query_dsl.Query;
import org.opensearch.client.opensearch.core.SearchResponse;
import org.opensearch.client.opensearch.core.search.FieldCollapse;
import org.opensearch.client.opensearch.core.search.Highlight;
import org.opensearch.client.opensearch.core.search.Pit;
import org.opensearch.client.opensearch.core.search.Rescore;
import org.opensearch.client.opensearch.core.search.SourceConfig;
import org.opensearch.client.opensearch.core.search.Suggester;
import org.opensearch.client.opensearch.core.search.TrackHits;
import org.opensearch.client.transport.Endpoint;
import org.opensearch.client.transport.endpoints.SimpleEndpoint;
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
// typedef: _global.search.Request
/**
* Returns results matching a query.
*/
@JsonpDeserializable
public class HybridSearchRequest extends RequestBase implements JsonpSerializable {
/**
* Json deserializer for {@link HybridSearchRequest}.
*/
public static final JsonpDeserializer<HybridSearchRequest> _DESERIALIZER =
ObjectBuilderDeserializer.lazy(
HybridSearchRequest.Builder::new,
HybridSearchRequest::setupSearchRequestDeserializer
);
/**
* Endpoint "{@code search}".
*/
public static final SimpleEndpoint<HybridSearchRequest, ?> _ENDPOINT = new SimpleEndpoint<>(
// Request method
request -> {
return "POST";
},
// Request path
request -> {
final int _index = 1 << 0;
int propsSet = 0;
if (ApiTypeHelper.isDefined(request.index())) {
propsSet |= _index;
}
if (propsSet == 0) {
return "/_search";
}
if (propsSet == (_index)) {
StringBuilder buf = new StringBuilder();
buf.append("/");
SimpleEndpoint.pathEncode(
request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf);
buf.append("/_search");
return buf.toString();
}
throw SimpleEndpoint.noPathTemplateFound("path");
},
// Request parameters
request -> {
Map<String, String> params = new HashMap<>();
params.put("typed_keys", "true");
if (request.df != null) {
params.put("df", request.df);
}
if (request.preFilterShardSize != null) {
params.put("pre_filter_shard_size", String.valueOf(request.preFilterShardSize));
}
if (request.minCompatibleShardNode != null) {
params.put("min_compatible_shard_node", request.minCompatibleShardNode);
}
if (request.lenient != null) {
params.put("lenient", String.valueOf(request.lenient));
}
if (request.routing != null) {
params.put("routing", request.routing);
}
if (request.ignoreUnavailable != null) {
params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable));
}
if (request.allowNoIndices != null) {
params.put("allow_no_indices", String.valueOf(request.allowNoIndices));
}
if (request.analyzer != null) {
params.put("analyzer", request.analyzer);
}
if (request.ignoreThrottled != null) {
params.put("ignore_throttled", String.valueOf(request.ignoreThrottled));
}
if (request.maxConcurrentShardRequests != null) {
params.put("max_concurrent_shard_requests",
String.valueOf(request.maxConcurrentShardRequests));
}
if (request.allowPartialSearchResults != null) {
params.put("allow_partial_search_results",
String.valueOf(request.allowPartialSearchResults));
}
if (ApiTypeHelper.isDefined(request.expandWildcards)) {
params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue())
.collect(Collectors.joining(",")));
}
if (request.preference != null) {
params.put("preference", request.preference);
}
if (request.analyzeWildcard != null) {
params.put("analyze_wildcard", String.valueOf(request.analyzeWildcard));
}
if (request.scroll != null) {
params.put("scroll", request.scroll._toJsonString());
}
if (request.searchType != null) {
params.put("search_type", request.searchType.jsonValue());
}
if (request.ccsMinimizeRoundtrips != null) {
params.put("ccs_minimize_roundtrips", String.valueOf(request.ccsMinimizeRoundtrips));
}
if (request.qcheckStyled != null) {
params.put("q", request.qcheckStyled);
}
if (request.defaultOperator != null) {
params.put("default_operator", request.defaultOperator.jsonValue());
}
if (request.requestCache != null) {
params.put("request_cache", String.valueOf(request.requestCache));
}
if (request.batchedReduceSize != null) {
params.put("batched_reduce_size", String.valueOf(request.batchedReduceSize));
}
if (request.searchPipeline != null) {
params.put("search_pipeline", request.searchPipeline);
}
return params;
},
SimpleEndpoint.emptyMap(),
true,
SearchResponse._DESERIALIZER
);
@Nullable
private final SourceConfig source;
private final Map<String, Aggregation> aggregations;
@Nullable
private final Boolean allowNoIndices;
@Nullable
private final Boolean allowPartialSearchResults;
@Nullable
private final Boolean analyzeWildcard;
@Nullable
private final String analyzer;
@Nullable
private final Long batchedReduceSize;
@Nullable
private final Boolean ccsMinimizeRoundtrips;
@Nullable
private final FieldCollapse collapse;
@Nullable
private final Operator defaultOperator;
@Nullable
private final String df;
private final List<FieldAndFormat> docvalueFields;
private final List<ExpandWildcard> expandWildcards;
@Nullable
private final Boolean explain;
private final List<FieldAndFormat> fields;
@Nullable
private final Integer from;
@Nullable
private final Highlight highlight;
@Nullable
private final Boolean ignoreThrottled;
@Nullable
private final Boolean ignoreUnavailable;
private final List<String> index;
private final List<Map<String, Double>> indicesBoost;
@Nullable
private final Boolean lenient;
@Nullable
private final Long maxConcurrentShardRequests;
@Nullable
private final String minCompatibleShardNode;
@Nullable
private final Double minScore;
@Nullable
private final Pit pit;
@Nullable
private final Query postFilter;
@Nullable
private final Long preFilterShardSize;
@Nullable
private final String preference;
@Nullable
private final Boolean profile;
@Nullable
@SuppressWarnings("all")
private final String qcheckStyled;
@Nullable
private final Query query;
@Nullable
private final Boolean requestCache;
private final List<Rescore> rescore;
@Nullable
private final String routing;
private final Map<String, RuntimeField> runtimeMappings;
private final Map<String, ScriptField> scriptFields;
@Nullable
private final Time scroll;
private final List<FieldValue> searchAfter;
@Nullable
private final SearchType searchType;
@Nullable
private final Boolean seqNoPrimaryTerm;
@Nullable
private final Integer size;
@Nullable
private final SlicedScroll slice;
private final List<SortOptions> sort;
private final List<String> stats;
private final List<String> storedFields;
@Nullable
private final Suggester suggest;
@Nullable
private final Long terminateAfter;
@Nullable
private final String timeout;
@Nullable
private final Boolean trackScores;
@Nullable
private final TrackHits trackTotalHits;
@Nullable
private final Boolean version;
// ---------------------------------------------------------------------------------------------
private final Map<String, JsonData> ext;
@Nullable
private final String searchPipeline;
private HybridSearchRequest(Builder builder) {
this.source = builder.source;
this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations);
this.allowNoIndices = builder.allowNoIndices;
this.allowPartialSearchResults = builder.allowPartialSearchResults;
this.analyzeWildcard = builder.analyzeWildcard;
this.analyzer = builder.analyzer;
this.batchedReduceSize = builder.batchedReduceSize;
this.ccsMinimizeRoundtrips = builder.ccsMinimizeRoundtrips;
this.collapse = builder.collapse;
this.defaultOperator = builder.defaultOperator;
this.df = builder.df;
this.docvalueFields = ApiTypeHelper.unmodifiable(builder.docvalueFields);
this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards);
this.explain = builder.explain;
this.fields = ApiTypeHelper.unmodifiable(builder.fields);
this.from = builder.from;
this.highlight = builder.highlight;
this.ignoreThrottled = builder.ignoreThrottled;
this.ignoreUnavailable = builder.ignoreUnavailable;
this.index = ApiTypeHelper.unmodifiable(builder.index);
this.indicesBoost = ApiTypeHelper.unmodifiable(builder.indicesBoost);
this.lenient = builder.lenient;
this.maxConcurrentShardRequests = builder.maxConcurrentShardRequests;
this.minCompatibleShardNode = builder.minCompatibleShardNode;
this.minScore = builder.minScore;
this.pit = builder.pit;
this.postFilter = builder.postFilter;
this.preFilterShardSize = builder.preFilterShardSize;
this.preference = builder.preference;
this.profile = builder.profile;
this.qcheckStyled
= builder.qcheckStyled
;
this.query = builder.query;
this.requestCache = builder.requestCache;
this.rescore = ApiTypeHelper.unmodifiable(builder.rescore);
this.routing = builder.routing;
this.runtimeMappings = ApiTypeHelper.unmodifiable(builder.runtimeMappings);
this.scriptFields = ApiTypeHelper.unmodifiable(builder.scriptFields);
this.scroll = builder.scroll;
this.searchAfter = ApiTypeHelper.unmodifiable(builder.searchAfter);
this.searchType = builder.searchType;
this.seqNoPrimaryTerm = builder.seqNoPrimaryTerm;
this.size = builder.size;
this.slice = builder.slice;
this.sort = ApiTypeHelper.unmodifiable(builder.sort);
this.stats = ApiTypeHelper.unmodifiable(builder.stats);
this.storedFields = ApiTypeHelper.unmodifiable(builder.storedFields);
this.suggest = builder.suggest;
this.terminateAfter = builder.terminateAfter;
this.timeout = builder.timeout;
this.trackScores = builder.trackScores;
this.trackTotalHits = builder.trackTotalHits;
this.version = builder.version;
this.ext = ApiTypeHelper.unmodifiable(builder.ext);
this.searchPipeline = builder.searchPipeline;
}
public static HybridSearchRequest of(
Function<HybridSearchRequest.Builder, ObjectBuilder<HybridSearchRequest>> fn) {
return fn.apply(new HybridSearchRequest.Builder()).build();
}
protected static void setupSearchRequestDeserializer(
ObjectDeserializer<HybridSearchRequest.Builder> op) {
op.add(HybridSearchRequest.Builder::source, SourceConfig._DESERIALIZER, "_source");
op.add(HybridSearchRequest.Builder::aggregations,
JsonpDeserializer.stringMapDeserializer(Aggregation._DESERIALIZER), "aggregations",
"aggs");
op.add(HybridSearchRequest.Builder::collapse, FieldCollapse._DESERIALIZER, "collapse");
op.add(HybridSearchRequest.Builder::docvalueFields,
JsonpDeserializer.arrayDeserializer(FieldAndFormat._DESERIALIZER), "docvalue_fields");
op.add(HybridSearchRequest.Builder::explain, JsonpDeserializer.booleanDeserializer(),
"explain");
op.add(HybridSearchRequest.Builder::fields,
JsonpDeserializer.arrayDeserializer(FieldAndFormat._DESERIALIZER), "fields");
op.add(HybridSearchRequest.Builder::from, JsonpDeserializer.integerDeserializer(), "from");
op.add(HybridSearchRequest.Builder::highlight, Highlight._DESERIALIZER, "highlight");
op.add(
HybridSearchRequest.Builder::indicesBoost,
JsonpDeserializer.arrayDeserializer(
JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.doubleDeserializer())),
"indices_boost"
);
op.add(HybridSearchRequest.Builder::minScore, JsonpDeserializer.doubleDeserializer(),
"min_score");
op.add(HybridSearchRequest.Builder::pit, Pit._DESERIALIZER, "pit");
op.add(HybridSearchRequest.Builder::postFilter, Query._DESERIALIZER, "post_filter");
op.add(HybridSearchRequest.Builder::profile, JsonpDeserializer.booleanDeserializer(),
"profile");
op.add(HybridSearchRequest.Builder::query, Query._DESERIALIZER, "query");
op.add(HybridSearchRequest.Builder::rescore,
JsonpDeserializer.arrayDeserializer(Rescore._DESERIALIZER), "rescore");
op.add(HybridSearchRequest.Builder::runtimeMappings,
JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER), "runtime_mappings");
op.add(HybridSearchRequest.Builder::scriptFields,
JsonpDeserializer.stringMapDeserializer(ScriptField._DESERIALIZER), "script_fields");
op.add(HybridSearchRequest.Builder::searchAfter,
JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "search_after");
op.add(HybridSearchRequest.Builder::seqNoPrimaryTerm, JsonpDeserializer.booleanDeserializer(),
"seq_no_primary_term");
op.add(HybridSearchRequest.Builder::size, JsonpDeserializer.integerDeserializer(), "size");
op.add(HybridSearchRequest.Builder::slice, SlicedScroll._DESERIALIZER, "slice");
op.add(HybridSearchRequest.Builder::sort,
JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort");
op.add(HybridSearchRequest.Builder::stats,
JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stats");
op.add(HybridSearchRequest.Builder::storedFields,
JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()),
"stored_fields");
op.add(HybridSearchRequest.Builder::suggest, Suggester._DESERIALIZER, "suggest");
op.add(HybridSearchRequest.Builder::terminateAfter, JsonpDeserializer.longDeserializer(),
"terminate_after");
op.add(HybridSearchRequest.Builder::timeout, JsonpDeserializer.stringDeserializer(), "timeout");
op.add(HybridSearchRequest.Builder::trackScores, JsonpDeserializer.booleanDeserializer(),
"track_scores");
op.add(HybridSearchRequest.Builder::trackTotalHits, TrackHits._DESERIALIZER,
"track_total_hits");
op.add(HybridSearchRequest.Builder::version, JsonpDeserializer.booleanDeserializer(),
"version");
op.add(HybridSearchRequest.Builder::ext,
JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "ext");
}
/**
* Create an "{@code search}" endpoint.
*/
public static <T> Endpoint<HybridSearchRequest, SearchResponse<T>, ErrorResponse>
createSearchEndpoint(
JsonpDeserializer<T> tdocumentDeserializer
) {
return _ENDPOINT.withResponseDeserializer(
SearchResponse.createSearchResponseDeserializer(tdocumentDeserializer));
}
/**
* Indicates which source fields are returned for matching documents. These
* fields are returned in the hits._source property of the search response.
* API name: {@code _source}
*/
@Nullable
public final SourceConfig source() {
return this.source;
}
/**
* API name: {@code aggregations}.
*/
public final Map<String, Aggregation> aggregations() {
return this.aggregations;
}
/**
* Whether to ignore if a wildcard indices expression resolves into no concrete
* indices. (This includes <code>_all</code> string or when no indices have been
* specified).
* API name: {@code allow_no_indices}
*/
@Nullable
public final Boolean allowNoIndices() {
return this.allowNoIndices;
}
/**
* Indicate if an error should be returned if there is a partial search failure
* or timeout.
* API name: {@code allow_partial_search_results}
*/
@Nullable
public final Boolean allowPartialSearchResults() {
return this.allowPartialSearchResults;
}
/**
* Specify whether wildcard and prefix queries should be analyzed (default:
* false).
* API name: {@code analyze_wildcard}
*/
@Nullable
public final Boolean analyzeWildcard() {
return this.analyzeWildcard;
}
/**
* The analyzer to use for the query string.
* API name: {@code analyzer}
*/
@Nullable
public final String analyzer() {
return this.analyzer;
}
/**
* The number of shard results that should be reduced at once on the
* coordinating node. This value should be used as a protection mechanism to
* reduce the memory overhead per search request if the potential number of
* shards in the request can be large.
* API name: {@code batched_reduce_size}
*/
@Nullable
public final Long batchedReduceSize() {
return this.batchedReduceSize;
}
/**
* Indicates whether network round-trips should be minimized as part of
* cross-cluster search requests execution.
* API name: {@code ccs_minimize_roundtrips}
*/
@Nullable
public final Boolean ccsMinimizeRoundtrips() {
return this.ccsMinimizeRoundtrips;
}
/**
* API name: {@code collapse}.
*/
@Nullable
public final FieldCollapse collapse() {
return this.collapse;
}
/**
* The default operator for query string query (AND or OR).
* API name: {@code default_operator}
*/
@Nullable
public final Operator defaultOperator() {
return this.defaultOperator;
}
/**
* The field to use as default where no field prefix is given in the query
* string.
* API name: {@code df}
*/
@Nullable
public final String df() {
return this.df;
}
/**
* Array of wildcard (*) patterns. The request returns doc values for field
* names matching these patterns in the hits.fields property of the response.
* API name: {@code docvalue_fields}
*/
public final List<FieldAndFormat> docvalueFields() {
return this.docvalueFields;
}
/**
* Whether to expand wildcard expression to concrete indices that are open,
* closed or both.
* API name: {@code expand_wildcards}
*/
public final List<ExpandWildcard> expandWildcards() {
return this.expandWildcards;
}
/**
* If true, returns detailed information about score computation as part of a
* hit.
* API name: {@code explain}
*/
@Nullable
public final Boolean explain() {
return this.explain;
}
/**
* Array of wildcard (*) patterns. The request returns values for field names
* matching these patterns in the hits.fields property of the response.
* API name: {@code fields}
*/
public final List<FieldAndFormat> fields() {
return this.fields;
}
/**
* Starting document offset. By default, you cannot page through more than
* 10,000 hits using the from and size parameters. To page through more hits,
* use the search_after parameter.
* API name: {@code from}
*/
@Nullable
public final Integer from() {
return this.from;
}
/**
* API name: {@code highlight}.
*/
@Nullable
public final Highlight highlight() {
return this.highlight;
}
/**
* Whether specified concrete, expanded or aliased indices should be ignored
* when throttled.
* API name: {@code ignore_throttled}
*/
@Nullable
public final Boolean ignoreThrottled() {
return this.ignoreThrottled;
}
/**
* Whether specified concrete indices should be ignored when unavailable
* (missing or closed).
* API name: {@code ignore_unavailable}
*/
@Nullable
public final Boolean ignoreUnavailable() {
return this.ignoreUnavailable;
}
/**
* A comma-separated list of index names to search; use <code>_all</code> or
* empty string to perform the operation on all indices.
* API name: {@code index}
*/
public final List<String> index() {
return this.index;
}
/**
* Boosts the _score of documents from specified indices.
* API name: {@code indices_boost}
*/
public final List<Map<String, Double>> indicesBoost() {
return this.indicesBoost;
}
/**
* Specify whether format-based query failures (such as providing text to a
* numeric field) should be ignored.
* API name: {@code lenient}
*/
@Nullable
public final Boolean lenient() {
return this.lenient;
}
/**
* The number of concurrent shard requests per node this search executes
* concurrently. This value should be used to limit the impact of the search on
* the cluster in order to limit the number of concurrent shard requests.
* API name: {@code max_concurrent_shard_requests}
*/
@Nullable
public final Long maxConcurrentShardRequests() {
return this.maxConcurrentShardRequests;
}
/**
* The minimum compatible version that all shards involved in search should have
* for this request to be successful.
* API name: {@code min_compatible_shard_node}
*/
@Nullable
public final String minCompatibleShardNode() {
return this.minCompatibleShardNode;
}
/**
* Minimum _score for matching documents. Documents with a lower _score are not
* included in the search results.
* API name: {@code min_score}
*/
@Nullable
public final Double minScore() {
return this.minScore;
}
/**
* API name: {@code pit}.
*/
@Nullable
public final Pit pit() {
return this.pit;
}
/**
* API name: {@code post_filter}.
*/
@Nullable
public final Query postFilter() {
return this.postFilter;
}
/**
* A threshold that enforces a pre-filter roundtrip to prefilter search shards
* based on query rewriting if the number of shards the search request expands
* to exceeds the threshold. This filter roundtrip can limit the number of
* shards significantly if for instance a shard can not match any documents
* based on its rewrite method ie. if date filters are mandatory to match but
* the shard bounds and the query are disjoint.
* API name: {@code pre_filter_shard_size}
*/
@Nullable
public final Long preFilterShardSize() {
return this.preFilterShardSize;
}
/**
* Specify the node or shard the operation should be performed on (default:
* random).
* API name: {@code preference}
*/
@Nullable
public final String preference() {
return this.preference;
}
/**
* API name: {@code profile}.
*/
@Nullable
public final Boolean profile() {
return this.profile;
}
/**
* Query in the Lucene query string syntax.
* API name: {@code qcheckStyled}
*/
@Nullable
public final String qcheckStyled() {
return this.qcheckStyled
;
}
/**
* Defines the search definition using the Query DSL.
* API name: {@code query}
*/
@Nullable
public final Query query() {
return this.query;
}
/**
* Specify if request cache should be used for this request or not, defaults to
* index level setting.
* API name: {@code request_cache}
*/
@Nullable
public final Boolean requestCache() {
return this.requestCache;
}
/**
* API name: {@code rescore}.
*/
public final List<Rescore> rescore() {
return this.rescore;
}
/**
* A comma-separated list of specific routing values.
* API name: {@code routing}
*/
@Nullable
public final String routing() {
return this.routing;
}
/**
* A comma-separated.
* API name: {@code routing}
*/
@Nullable
public final String searchPipeline() {
return this.searchPipeline;
}
/**
* Defines one or more runtime fields in the search request. These fields take
* precedence over mapped fields with the same name.
* API name: {@code runtime_mappings}
*/
public final Map<String, RuntimeField> runtimeMappings() {
return this.runtimeMappings;
}
/**
* Retrieve a script evaluation (based on different fields) for each hit.
* API name: {@code script_fields}
*/
public final Map<String, ScriptField> scriptFields() {
return this.scriptFields;
}
/**
* Specify how long a consistent view of the index should be maintained for
* scrolled search.
* API name: {@code scroll}
*/
@Nullable
public final Time scroll() {
return this.scroll;
}
/**
* API name: {@code search_after}.
*/
public final List<FieldValue> searchAfter() {
return this.searchAfter;
}
/**
* Search operation type.
* API name: {@code search_type}
*/
@Nullable
public final SearchType searchType() {
return this.searchType;
}
/**
* If true, returns sequence number and primary term of the last modification of
* each hit. See Optimistic concurrency control.
* API name: {@code seq_no_primary_term}
*/
@Nullable
public final Boolean seqNoPrimaryTerm() {
return this.seqNoPrimaryTerm;
}
/**
* The number of hits to return. By default, you cannot page through more than
* 10,000 hits using the from and size parameters. To page through more hits,
* use the search_after parameter.
* API name: {@code size}
*/
@Nullable
public final Integer size() {
return this.size;
}
/**
* API name: {@code slice}.
*/
@Nullable
public final SlicedScroll slice() {
return this.slice;
}
/**
* API name: {@code sort}.
*/
public final List<SortOptions> sort() {
return this.sort;
}
/**
* Stats groups to associate with the search. Each group maintains a statistics
* aggregation for its associated searches. You can retrieve these stats using
* the indices stats API.
* API name: {@code stats}
*/
public final List<String> stats() {
return this.stats;
}
/**
* List of stored fields to return as part of a hit. If no fields are specified,
* no stored fields are included in the response. If this field is specified,
* the _source parameter defaults to false. You can pass _source: true to return
* both source fields and stored fields in the search response.
* API name: {@code stored_fields}
*/
public final List<String> storedFields() {
return this.storedFields;
}
/**
* API name: {@code suggest}.
*/
@Nullable
public final Suggester suggest() {
return this.suggest;
}
/**
* Maximum number of documents to collect for each shard. If a query reaches
* this limit, OpenSearch terminates the query early. OpenSearch collects
* documents before sorting. Defaults to 0, which does not terminate query
* execution early.
* API name: {@code terminate_after}
*/
@Nullable
public final Long terminateAfter() {
return this.terminateAfter;
}
/**
* Specifies the period of time to wait for a response from each shard. If no
* response is received before the timeout expires, the request fails and
* returns an error. Defaults to no timeout.
* API name: {@code timeout}
*/
@Nullable
public final String timeout() {
return this.timeout;
}
/**
* If true, calculate and return document scores, even if the scores are not
* used for sorting.
* API name: {@code track_scores}
*/
@Nullable
public final Boolean trackScores() {
return this.trackScores;
}
/**
* Number of hits matching the query to count accurately. If true, the exact
* number of hits is returned at the cost of some performance. If false, the
* response does not include the total number of hits matching the query.
* Defaults to 10,000 hits.
* API name: {@code track_total_hits}
*/
@Nullable
public final TrackHits trackTotalHits() {
return this.trackTotalHits;
}
/**
* If true, returns document version as part of a hit.
* API name: {@code version}
*/
@Nullable
public final Boolean version() {
return this.version;
}
// ---------------------------------------------------------------------------------------------
/**
* API name: {@code ext}.
*/
public final Map<String, JsonData> ext() {
return this.ext;
}
// ---------------------------------------------------------------------------------------------
/**
* Serialize this object to JSON.
*/
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
generator.writeEnd();
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (this.source != null) {
generator.writeKey("_source");
this.source.serialize(generator, mapper);
}
if (ApiTypeHelper.isDefined(this.aggregations)) {
generator.writeKey("aggregations");
generator.writeStartObject();
for (Map.Entry<String, Aggregation> item0 : this.aggregations.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
}
generator.writeEnd();
}
if (this.collapse != null) {
generator.writeKey("collapse");
this.collapse.serialize(generator, mapper);
}
if (ApiTypeHelper.isDefined(this.docvalueFields)) {
generator.writeKey("docvalue_fields");
generator.writeStartArray();
for (FieldAndFormat item0 : this.docvalueFields) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
if (this.explain != null) {
generator.writeKey("explain");
generator.write(this.explain);
}
if (ApiTypeHelper.isDefined(this.fields)) {
generator.writeKey("fields");
generator.writeStartArray();
for (FieldAndFormat item0 : this.fields) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
if (this.from != null) {
generator.writeKey("from");
generator.write(this.from);
}
if (this.highlight != null) {
generator.writeKey("highlight");
this.highlight.serialize(generator, mapper);
}
if (ApiTypeHelper.isDefined(this.indicesBoost)) {
generator.writeKey("indices_boost");
generator.writeStartArray();
for (Map<String, Double> item0 : this.indicesBoost) {
generator.writeStartObject();
if (item0 != null) {