46
46
import org .opensearch .client .opensearch ._types .ScriptField ;
47
47
import org .opensearch .client .opensearch ._types .SortOptions ;
48
48
import org .opensearch .client .opensearch ._types .aggregations .Aggregation ;
49
+ import org .opensearch .client .opensearch ._types .query_dsl .FieldAndFormat ;
49
50
import org .opensearch .client .opensearch ._types .query_dsl .Query ;
51
+ import org .opensearch .client .opensearch .core .SearchRequest .Builder ;
50
52
import org .opensearch .client .opensearch .core .search .Highlight ;
51
53
import org .opensearch .client .opensearch .core .search .SourceConfig ;
52
54
import org .opensearch .client .opensearch .core .search .Suggester ;
@@ -97,6 +99,18 @@ public class MultisearchBody implements JsonpSerializable {
97
99
98
100
private final Map <String , ScriptField > scriptFields ;
99
101
102
+ @ Nullable
103
+ private final Boolean seqNoPrimaryTerm ;
104
+
105
+ private final List <String > storedFields ;
106
+
107
+ @ Nullable
108
+ private final Boolean explain ;
109
+
110
+ private final List <FieldAndFormat > fields ;
111
+
112
+ private final List <Map <String , Double >> indicesBoost ;
113
+
100
114
// ---------------------------------------------------------------------------------------------
101
115
102
116
private MultisearchBody (Builder builder ) {
@@ -115,6 +129,11 @@ private MultisearchBody(Builder builder) {
115
129
this .highlight = builder .highlight ;
116
130
this .source = builder .source ;
117
131
this .scriptFields = ApiTypeHelper .unmodifiable (builder .scriptFields );
132
+ this .seqNoPrimaryTerm = builder .seqNoPrimaryTerm ;
133
+ this .storedFields = ApiTypeHelper .unmodifiable (builder .storedFields );
134
+ this .explain = builder .explain ;
135
+ this .fields = ApiTypeHelper .unmodifiable (builder .fields );
136
+ this .indicesBoost = ApiTypeHelper .unmodifiable (builder .indicesBoost );
118
137
}
119
138
120
139
public static MultisearchBody of (Function <Builder , ObjectBuilder <MultisearchBody >> fn ) {
@@ -226,6 +245,59 @@ public final Map<String, ScriptField> scriptFields() {
226
245
return this .scriptFields ;
227
246
}
228
247
248
+ /**
249
+ * If true, returns sequence number and primary term of the last modification of
250
+ * each hit. See Optimistic concurrency control.
251
+ * <p>
252
+ * API name: {@code seq_no_primary_term}
253
+ */
254
+ @ Nullable
255
+ public final Boolean seqNoPrimaryTerm () {
256
+ return this .seqNoPrimaryTerm ;
257
+ }
258
+
259
+ /**
260
+ * List of stored fields to return as part of a hit. If no fields are specified,
261
+ * no stored fields are included in the response. If this field is specified,
262
+ * the _source parameter defaults to false. You can pass _source: true to return
263
+ * both source fields and stored fields in the search response.
264
+ * <p>
265
+ * API name: {@code stored_fields}
266
+ */
267
+ public final List <String > storedFields () {
268
+ return this .storedFields ;
269
+ }
270
+
271
+ /**
272
+ * If true, returns detailed information about score computation as part of a
273
+ * hit.
274
+ * <p>
275
+ * API name: {@code explain}
276
+ */
277
+ @ Nullable
278
+ public final Boolean explain () {
279
+ return this .explain ;
280
+ }
281
+
282
+ /**
283
+ * Array of wildcard (*) patterns. The request returns values for field names
284
+ * matching these patterns in the hits.fields property of the response.
285
+ * <p>
286
+ * API name: {@code fields}
287
+ */
288
+ public final List <FieldAndFormat > fields () {
289
+ return this .fields ;
290
+ }
291
+
292
+ /**
293
+ * Boosts the _score of documents from specified indices.
294
+ * <p>
295
+ * API name: {@code indices_boost}
296
+ */
297
+ public final List <Map <String , Double >> indicesBoost () {
298
+ return this .indicesBoost ;
299
+ }
300
+
229
301
/**
230
302
* Serialize this object to JSON.
231
303
*/
@@ -333,6 +405,54 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
333
405
334
406
}
335
407
408
+ if (this .seqNoPrimaryTerm != null ) {
409
+ generator .writeKey ("seq_no_primary_term" );
410
+ generator .write (this .seqNoPrimaryTerm );
411
+ }
412
+
413
+ if (ApiTypeHelper .isDefined (this .storedFields )) {
414
+ generator .writeKey ("stored_fields" );
415
+ generator .writeStartArray ();
416
+ for (String item0 : this .storedFields ) {
417
+ generator .write (item0 );
418
+
419
+ }
420
+ generator .writeEnd ();
421
+ }
422
+
423
+ if (this .explain != null ) {
424
+ generator .writeKey ("explain" );
425
+ generator .write (this .explain );
426
+
427
+ }
428
+
429
+ if (ApiTypeHelper .isDefined (this .fields )) {
430
+ generator .writeKey ("fields" );
431
+ generator .writeStartArray ();
432
+ for (FieldAndFormat item0 : this .fields ) {
433
+ item0 .serialize (generator , mapper );
434
+
435
+ }
436
+ generator .writeEnd ();
437
+ }
438
+
439
+ if (ApiTypeHelper .isDefined (this .indicesBoost )) {
440
+ generator .writeKey ("indices_boost" );
441
+ generator .writeStartArray ();
442
+ for (Map <String , Double > item0 : this .indicesBoost ) {
443
+ generator .writeStartObject ();
444
+ if (item0 != null ) {
445
+ for (Map .Entry <String , Double > item1 : item0 .entrySet ()) {
446
+ generator .writeKey (item1 .getKey ());
447
+ generator .write (item1 .getValue ());
448
+
449
+ }
450
+ }
451
+ generator .writeEnd ();
452
+
453
+ }
454
+ generator .writeEnd ();
455
+ }
336
456
}
337
457
338
458
// ---------------------------------------------------------------------------------------------
@@ -383,6 +503,21 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<M
383
503
384
504
private Map <String , ScriptField > scriptFields ;
385
505
506
+ @ Nullable
507
+ private Boolean seqNoPrimaryTerm ;
508
+
509
+ @ Nullable
510
+ private List <String > storedFields ;
511
+
512
+ @ Nullable
513
+ private Boolean explain ;
514
+
515
+ @ Nullable
516
+ private List <FieldAndFormat > fields ;
517
+
518
+ @ Nullable
519
+ private List <Map <String , Double >> indicesBoost ;
520
+
386
521
/**
387
522
* API name: {@code aggregations}
388
523
* <p>
@@ -612,6 +747,120 @@ public final Builder scriptFields(String key, Function<ScriptField.Builder, Obje
612
747
return scriptFields (key , fn .apply (new ScriptField .Builder ()).build ());
613
748
}
614
749
750
+ /**
751
+ * If true, returns sequence number and primary term of the last modification of
752
+ * each hit. See Optimistic concurrency control.
753
+ * <p>
754
+ * API name: {@code seq_no_primary_term}
755
+ */
756
+ public final Builder seqNoPrimaryTerm (@ Nullable Boolean value ) {
757
+ this .seqNoPrimaryTerm = value ;
758
+ return this ;
759
+ }
760
+
761
+ /**
762
+ * List of stored fields to return as part of a hit. If no fields are specified,
763
+ * no stored fields are included in the response. If this field is specified,
764
+ * the _source parameter defaults to false. You can pass _source: true to return
765
+ * both source fields and stored fields in the search response.
766
+ * <p>
767
+ * API name: {@code stored_fields}
768
+ * <p>
769
+ * Adds all elements of <code>list</code> to <code>storedFields</code>.
770
+ */
771
+ public final Builder storedFields (List <String > list ) {
772
+ this .storedFields = _listAddAll (this .storedFields , list );
773
+ return this ;
774
+ }
775
+
776
+ /**
777
+ * List of stored fields to return as part of a hit. If no fields are specified,
778
+ * no stored fields are included in the response. If this field is specified,
779
+ * the _source parameter defaults to false. You can pass _source: true to return
780
+ * both source fields and stored fields in the search response.
781
+ * <p>
782
+ * API name: {@code stored_fields}
783
+ * <p>
784
+ * Adds one or more values to <code>storedFields</code>.
785
+ */
786
+ public final Builder storedFields (String value , String ... values ) {
787
+ this .storedFields = _listAdd (this .storedFields , value , values );
788
+ return this ;
789
+ }
790
+
791
+ /**
792
+ * If true, returns detailed information about score computation as part of a
793
+ * hit.
794
+ * <p>
795
+ * API name: {@code explain}
796
+ */
797
+ public final Builder explain (@ Nullable Boolean value ) {
798
+ this .explain = value ;
799
+ return this ;
800
+ }
801
+
802
+ /**
803
+ * Array of wildcard (*) patterns. The request returns values for field names
804
+ * matching these patterns in the hits.fields property of the response.
805
+ * <p>
806
+ * API name: {@code fields}
807
+ * <p>
808
+ * Adds all elements of <code>list</code> to <code>fields</code>.
809
+ */
810
+ public final Builder fields (List <FieldAndFormat > list ) {
811
+ this .fields = _listAddAll (this .fields , list );
812
+ return this ;
813
+ }
814
+
815
+ /**
816
+ * Array of wildcard (*) patterns. The request returns values for field names
817
+ * matching these patterns in the hits.fields property of the response.
818
+ * <p>
819
+ * API name: {@code fields}
820
+ * <p>
821
+ * Adds one or more values to <code>fields</code>.
822
+ */
823
+ public final Builder fields (FieldAndFormat value , FieldAndFormat ... values ) {
824
+ this .fields = _listAdd (this .fields , value , values );
825
+ return this ;
826
+ }
827
+
828
+ /**
829
+ * Array of wildcard (*) patterns. The request returns values for field names
830
+ * matching these patterns in the hits.fields property of the response.
831
+ * <p>
832
+ * API name: {@code fields}
833
+ * <p>
834
+ * Adds a value to <code>fields</code> using a builder lambda.
835
+ */
836
+ public final Builder fields (Function <FieldAndFormat .Builder , ObjectBuilder <FieldAndFormat >> fn ) {
837
+ return fields (fn .apply (new FieldAndFormat .Builder ()).build ());
838
+ }
839
+
840
+ /**
841
+ * Boosts the _score of documents from specified indices.
842
+ * <p>
843
+ * API name: {@code indices_boost}
844
+ * <p>
845
+ * Adds all elements of <code>list</code> to <code>indicesBoost</code>.
846
+ */
847
+ public final Builder indicesBoost (List <Map <String , Double >> list ) {
848
+ this .indicesBoost = _listAddAll (this .indicesBoost , list );
849
+ return this ;
850
+ }
851
+
852
+ /**
853
+ * Boosts the _score of documents from specified indices.
854
+ * <p>
855
+ * API name: {@code indices_boost}
856
+ * <p>
857
+ * Adds one or more values to <code>indicesBoost</code>.
858
+ */
859
+ public final Builder indicesBoost (Map <String , Double > value , Map <String , Double >... values ) {
860
+ this .indicesBoost = _listAdd (this .indicesBoost , value , values );
861
+ return this ;
862
+ }
863
+
615
864
/**
616
865
* Builds a {@link MultisearchBody}.
617
866
*
@@ -651,7 +900,15 @@ protected static void setupMultisearchBodyDeserializer(ObjectDeserializer<Multis
651
900
op .add (Builder ::highlight , Highlight ._DESERIALIZER , "highlight" );
652
901
op .add (Builder ::source , SourceConfig ._DESERIALIZER , "_source" );
653
902
op .add (Builder ::scriptFields , JsonpDeserializer .stringMapDeserializer (ScriptField ._DESERIALIZER ), "script_fields" );
654
-
903
+ op .add (Builder ::seqNoPrimaryTerm , JsonpDeserializer .booleanDeserializer (), "seq_no_primary_term" );
904
+ op .add (Builder ::storedFields , JsonpDeserializer .arrayDeserializer (JsonpDeserializer .stringDeserializer ()), "stored_fields" );
905
+ op .add (Builder ::explain , JsonpDeserializer .booleanDeserializer (), "explain" );
906
+ op .add (Builder ::fields , JsonpDeserializer .arrayDeserializer (FieldAndFormat ._DESERIALIZER ), "fields" );
907
+ op .add (
908
+ Builder ::indicesBoost ,
909
+ JsonpDeserializer .arrayDeserializer (JsonpDeserializer .stringMapDeserializer (JsonpDeserializer .doubleDeserializer ())),
910
+ "indices_boost"
911
+ );
655
912
}
656
913
657
914
}
0 commit comments