Skip to content

Commit 0307af7

Browse files
[8.19] Regenerate client (#1193)
* [codegen] update to latest spec * revert unwanted changes --------- Co-authored-by: Laura Trotta <laura.trotta@elastic.co>
1 parent 253548c commit 0307af7

File tree

11 files changed

+425
-397
lines changed

11 files changed

+425
-397
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex/Source.java

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import co.elastic.clients.elasticsearch._types.mapping.RuntimeField;
2525
import co.elastic.clients.elasticsearch._types.query_dsl.Query;
2626
import co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant;
27+
import co.elastic.clients.elasticsearch.core.search.SourceConfig;
2728
import co.elastic.clients.json.JsonpDeserializable;
2829
import co.elastic.clients.json.JsonpDeserializer;
2930
import co.elastic.clients.json.JsonpMapper;
@@ -83,7 +84,8 @@ public class Source implements JsonpSerializable {
8384

8485
private final List<SortOptions> sort;
8586

86-
private final List<String> sourceFields;
87+
@Nullable
88+
private final SourceConfig sourceFields;
8789

8890
private final Map<String, RuntimeField> runtimeMappings;
8991

@@ -97,7 +99,7 @@ private Source(Builder builder) {
9799
this.size = builder.size;
98100
this.slice = builder.slice;
99101
this.sort = ApiTypeHelper.unmodifiable(builder.sort);
100-
this.sourceFields = ApiTypeHelper.unmodifiable(builder.sourceFields);
102+
this.sourceFields = builder.sourceFields;
101103
this.runtimeMappings = ApiTypeHelper.unmodifiable(builder.runtimeMappings);
102104

103105
}
@@ -185,7 +187,8 @@ public final List<SortOptions> sort() {
185187
* <p>
186188
* API name: {@code _source}
187189
*/
188-
public final List<String> sourceFields() {
190+
@Nullable
191+
public final SourceConfig sourceFields() {
189192
return this.sourceFields;
190193
}
191194

@@ -247,14 +250,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
247250
generator.writeEnd();
248251

249252
}
250-
if (ApiTypeHelper.isDefined(this.sourceFields)) {
253+
if (this.sourceFields != null) {
251254
generator.writeKey("_source");
252-
generator.writeStartArray();
253-
for (String item0 : this.sourceFields) {
254-
generator.write(item0);
255-
256-
}
257-
generator.writeEnd();
255+
this.sourceFields.serialize(generator, mapper);
258256

259257
}
260258
if (ApiTypeHelper.isDefined(this.runtimeMappings)) {
@@ -301,7 +299,7 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
301299
private List<SortOptions> sort;
302300

303301
@Nullable
304-
private List<String> sourceFields;
302+
private SourceConfig sourceFields;
305303

306304
@Nullable
307305
private Map<String, RuntimeField> runtimeMappings;
@@ -499,11 +497,9 @@ public final Builder sort(Function<SortOptions.Builder, ObjectBuilder<SortOption
499497
* select fields.
500498
* <p>
501499
* API name: {@code _source}
502-
* <p>
503-
* Adds all elements of <code>list</code> to <code>sourceFields</code>.
504500
*/
505-
public final Builder sourceFields(List<String> list) {
506-
this.sourceFields = _listAddAll(this.sourceFields, list);
501+
public final Builder sourceFields(@Nullable SourceConfig value) {
502+
this.sourceFields = value;
507503
return this;
508504
}
509505

@@ -512,12 +508,9 @@ public final Builder sourceFields(List<String> list) {
512508
* select fields.
513509
* <p>
514510
* API name: {@code _source}
515-
* <p>
516-
* Adds one or more values to <code>sourceFields</code>.
517511
*/
518-
public final Builder sourceFields(String value, String... values) {
519-
this.sourceFields = _listAdd(this.sourceFields, value, values);
520-
return this;
512+
public final Builder sourceFields(Function<SourceConfig.Builder, ObjectBuilder<SourceConfig>> fn) {
513+
return this.sourceFields(fn.apply(new SourceConfig.Builder()).build());
521514
}
522515

523516
/**
@@ -590,8 +583,7 @@ protected static void setupSourceDeserializer(ObjectDeserializer<Source.Builder>
590583
op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size");
591584
op.add(Builder::slice, SlicedScroll._DESERIALIZER, "slice");
592585
op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort");
593-
op.add(Builder::sourceFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()),
594-
"_source");
586+
op.add(Builder::sourceFields, SourceConfig._DESERIALIZER, "_source");
595587
op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER),
596588
"runtime_mappings");
597589

java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/PhraseSuggester.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ public class PhraseSuggester extends SuggesterBase implements FieldSuggesterVari
9393
@Nullable
9494
private final SmoothingModel smoothing;
9595

96-
@Nullable
97-
private final String text;
98-
9996
@Nullable
10097
private final Integer tokenLimit;
10198

@@ -115,7 +112,6 @@ private PhraseSuggester(Builder builder) {
115112
this.separator = builder.separator;
116113
this.shardSize = builder.shardSize;
117114
this.smoothing = builder.smoothing;
118-
this.text = builder.text;
119115
this.tokenLimit = builder.tokenLimit;
120116

121117
}
@@ -255,16 +251,6 @@ public final SmoothingModel smoothing() {
255251
return this.smoothing;
256252
}
257253

258-
/**
259-
* The text/query to provide suggestions for.
260-
* <p>
261-
* API name: {@code text}
262-
*/
263-
@Nullable
264-
public final String text() {
265-
return this.text;
266-
}
267-
268254
/**
269255
* API name: {@code token_limit}
270256
*/
@@ -335,11 +321,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
335321
generator.writeKey("smoothing");
336322
this.smoothing.serialize(generator, mapper);
337323

338-
}
339-
if (this.text != null) {
340-
generator.writeKey("text");
341-
generator.write(this.text);
342-
343324
}
344325
if (this.tokenLimit != null) {
345326
generator.writeKey("token_limit");
@@ -391,9 +372,6 @@ public static class Builder extends SuggesterBase.AbstractBuilder<Builder>
391372
@Nullable
392373
private SmoothingModel smoothing;
393374

394-
@Nullable
395-
private String text;
396-
397375
@Nullable
398376
private Integer tokenLimit;
399377

@@ -411,7 +389,6 @@ private Builder(PhraseSuggester instance) {
411389
this.separator = instance.separator;
412390
this.shardSize = instance.shardSize;
413391
this.smoothing = instance.smoothing;
414-
this.text = instance.text;
415392
this.tokenLimit = instance.tokenLimit;
416393

417394
}
@@ -610,16 +587,6 @@ public final Builder smoothing(SmoothingModelVariant value) {
610587
return this;
611588
}
612589

613-
/**
614-
* The text/query to provide suggestions for.
615-
* <p>
616-
* API name: {@code text}
617-
*/
618-
public final Builder text(@Nullable String value) {
619-
this.text = value;
620-
return this;
621-
}
622-
623590
/**
624591
* API name: {@code token_limit}
625592
*/
@@ -674,7 +641,6 @@ protected static void setupPhraseSuggesterDeserializer(ObjectDeserializer<Phrase
674641
op.add(Builder::separator, JsonpDeserializer.stringDeserializer(), "separator");
675642
op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size");
676643
op.add(Builder::smoothing, SmoothingModel._DESERIALIZER, "smoothing");
677-
op.add(Builder::text, JsonpDeserializer.stringDeserializer(), "text");
678644
op.add(Builder::tokenLimit, JsonpDeserializer.integerDeserializer(), "token_limit");
679645

680646
}

java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/TermSuggester.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.lang.Boolean;
3131
import java.lang.Float;
3232
import java.lang.Integer;
33-
import java.lang.String;
3433
import java.util.Objects;
3534
import java.util.function.Function;
3635
import javax.annotation.Nullable;
@@ -93,9 +92,6 @@ public class TermSuggester extends SuggesterBase implements FieldSuggesterVarian
9392
@Nullable
9493
private final SuggestMode suggestMode;
9594

96-
@Nullable
97-
private final String text;
98-
9995
// ---------------------------------------------------------------------------------------------
10096

10197
private TermSuggester(Builder builder) {
@@ -112,7 +108,6 @@ private TermSuggester(Builder builder) {
112108
this.sort = builder.sort;
113109
this.stringDistance = builder.stringDistance;
114110
this.suggestMode = builder.suggestMode;
115-
this.text = builder.text;
116111

117112
}
118113

@@ -252,16 +247,6 @@ public final SuggestMode suggestMode() {
252247
return this.suggestMode;
253248
}
254249

255-
/**
256-
* The suggest text. Needs to be set globally or per suggestion.
257-
* <p>
258-
* API name: {@code text}
259-
*/
260-
@Nullable
261-
public final String text() {
262-
return this.text;
263-
}
264-
265250
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
266251

267252
super.serializeInternal(generator, mapper);
@@ -317,11 +302,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
317302
generator.writeKey("suggest_mode");
318303
this.suggestMode.serialize(generator, mapper);
319304
}
320-
if (this.text != null) {
321-
generator.writeKey("text");
322-
generator.write(this.text);
323-
324-
}
325305

326306
}
327307

@@ -365,9 +345,6 @@ public static class Builder extends SuggesterBase.AbstractBuilder<Builder> imple
365345
@Nullable
366346
private SuggestMode suggestMode;
367347

368-
@Nullable
369-
private String text;
370-
371348
public Builder() {
372349
}
373350
private Builder(TermSuggester instance) {
@@ -382,7 +359,6 @@ private Builder(TermSuggester instance) {
382359
this.sort = instance.sort;
383360
this.stringDistance = instance.stringDistance;
384361
this.suggestMode = instance.suggestMode;
385-
this.text = instance.text;
386362

387363
}
388364
/**
@@ -509,16 +485,6 @@ public final Builder suggestMode(@Nullable SuggestMode value) {
509485
return this;
510486
}
511487

512-
/**
513-
* The suggest text. Needs to be set globally or per suggestion.
514-
* <p>
515-
* API name: {@code text}
516-
*/
517-
public final Builder text(@Nullable String value) {
518-
this.text = value;
519-
return this;
520-
}
521-
522488
@Override
523489
protected Builder self() {
524490
return this;
@@ -564,7 +530,6 @@ protected static void setupTermSuggesterDeserializer(ObjectDeserializer<TermSugg
564530
op.add(Builder::sort, SuggestSort._DESERIALIZER, "sort");
565531
op.add(Builder::stringDistance, StringDistance._DESERIALIZER, "string_distance");
566532
op.add(Builder::suggestMode, SuggestMode._DESERIALIZER, "suggest_mode");
567-
op.add(Builder::text, JsonpDeserializer.stringDeserializer(), "text");
568533

569534
}
570535

0 commit comments

Comments
 (0)