49
49
import org .opensearch .client .opensearch ._types .query_dsl .FieldAndFormat ;
50
50
import org .opensearch .client .opensearch ._types .query_dsl .Query ;
51
51
import org .opensearch .client .opensearch .core .SearchRequest .Builder ;
52
+ import org .opensearch .client .opensearch .core .search .FieldCollapse ;
52
53
import org .opensearch .client .opensearch .core .search .Highlight ;
53
54
import org .opensearch .client .opensearch .core .search .SourceConfig ;
54
55
import org .opensearch .client .opensearch .core .search .Suggester ;
@@ -111,6 +112,15 @@ public class MultisearchBody implements JsonpSerializable {
111
112
112
113
private final List <Map <String , Double >> indicesBoost ;
113
114
115
+ @ Nullable
116
+ private final FieldCollapse collapse ;
117
+
118
+ @ Nullable
119
+ private final Boolean version ;
120
+
121
+ @ Nullable
122
+ private final String timeout ;
123
+
114
124
// ---------------------------------------------------------------------------------------------
115
125
116
126
private MultisearchBody (Builder builder ) {
@@ -134,6 +144,9 @@ private MultisearchBody(Builder builder) {
134
144
this .explain = builder .explain ;
135
145
this .fields = ApiTypeHelper .unmodifiable (builder .fields );
136
146
this .indicesBoost = ApiTypeHelper .unmodifiable (builder .indicesBoost );
147
+ this .collapse = builder .collapse ;
148
+ this .version = builder .version ;
149
+ this .timeout = builder .timeout ;
137
150
}
138
151
139
152
public static MultisearchBody of (Function <Builder , ObjectBuilder <MultisearchBody >> fn ) {
@@ -298,6 +311,36 @@ public final List<Map<String, Double>> indicesBoost() {
298
311
return this .indicesBoost ;
299
312
}
300
313
314
+ /**
315
+ * API name: {@code collapse}
316
+ */
317
+ @ Nullable
318
+ public final FieldCollapse collapse () {
319
+ return this .collapse ;
320
+ }
321
+
322
+ /**
323
+ * If true, returns document version as part of a hit.
324
+ * <p>
325
+ * API name: {@code version}
326
+ */
327
+ @ Nullable
328
+ public final Boolean version () {
329
+ return this .version ;
330
+ }
331
+
332
+ /**
333
+ * Specifies the period of time to wait for a response from each shard. If no
334
+ * response is received before the timeout expires, the request fails and
335
+ * returns an error. Defaults to no timeout.
336
+ * <p>
337
+ * API name: {@code timeout}
338
+ */
339
+ @ Nullable
340
+ public final String timeout () {
341
+ return this .timeout ;
342
+ }
343
+
301
344
/**
302
345
* Serialize this object to JSON.
303
346
*/
@@ -453,6 +496,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
453
496
}
454
497
generator .writeEnd ();
455
498
}
499
+
500
+ if (this .collapse != null ) {
501
+ generator .writeKey ("collapse" );
502
+ this .collapse .serialize (generator , mapper );
503
+ }
504
+
505
+ if (this .version != null ) {
506
+ generator .writeKey ("version" );
507
+ generator .write (this .version );
508
+ }
509
+
510
+ if (this .timeout != null ) {
511
+ generator .writeKey ("timeout" );
512
+ generator .write (this .timeout );
513
+ }
456
514
}
457
515
458
516
// ---------------------------------------------------------------------------------------------
@@ -518,6 +576,15 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<M
518
576
@ Nullable
519
577
private List <Map <String , Double >> indicesBoost ;
520
578
579
+ @ Nullable
580
+ private FieldCollapse collapse ;
581
+
582
+ @ Nullable
583
+ private Boolean version ;
584
+
585
+ @ Nullable
586
+ private String timeout ;
587
+
521
588
/**
522
589
* API name: {@code aggregations}
523
590
* <p>
@@ -861,6 +928,43 @@ public final Builder indicesBoost(Map<String, Double> value, Map<String, Double>
861
928
return this ;
862
929
}
863
930
931
+ /**
932
+ * API name: {@code collapse}
933
+ */
934
+ public final Builder collapse (@ Nullable FieldCollapse value ) {
935
+ this .collapse = value ;
936
+ return this ;
937
+ }
938
+
939
+ /**
940
+ * API name: {@code collapse}
941
+ */
942
+ public final Builder collapse (Function <FieldCollapse .Builder , ObjectBuilder <FieldCollapse >> fn ) {
943
+ return this .collapse (fn .apply (new FieldCollapse .Builder ()).build ());
944
+ }
945
+
946
+ /**
947
+ * If true, returns document version as part of a hit.
948
+ * <p>
949
+ * API name: {@code version}
950
+ */
951
+ public final Builder version (@ Nullable Boolean value ) {
952
+ this .version = value ;
953
+ return this ;
954
+ }
955
+
956
+ /**
957
+ * Specifies the period of time to wait for a response from each shard. If no
958
+ * response is received before the timeout expires, the request fails and
959
+ * returns an error. Defaults to no timeout.
960
+ * <p>
961
+ * API name: {@code timeout}
962
+ */
963
+ public final Builder timeout (@ Nullable String value ) {
964
+ this .timeout = value ;
965
+ return this ;
966
+ }
967
+
864
968
/**
865
969
* Builds a {@link MultisearchBody}.
866
970
*
@@ -909,6 +1013,9 @@ protected static void setupMultisearchBodyDeserializer(ObjectDeserializer<Multis
909
1013
JsonpDeserializer .arrayDeserializer (JsonpDeserializer .stringMapDeserializer (JsonpDeserializer .doubleDeserializer ())),
910
1014
"indices_boost"
911
1015
);
1016
+ op .add (Builder ::collapse , FieldCollapse ._DESERIALIZER , "collapse" );
1017
+ op .add (Builder ::version , JsonpDeserializer .booleanDeserializer (), "version" );
1018
+ op .add (Builder ::timeout , JsonpDeserializer .stringDeserializer (), "timeout" );
912
1019
}
913
1020
914
1021
}
0 commit comments