Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import co.elastic.clients.elasticsearch._types.mapping.RuntimeField;
import co.elastic.clients.elasticsearch._types.query_dsl.Query;
import co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant;
import co.elastic.clients.elasticsearch.core.search.SourceConfig;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
Expand Down Expand Up @@ -83,7 +84,8 @@ public class Source implements JsonpSerializable {

private final List<SortOptions> sort;

private final List<String> sourceFields;
@Nullable
private final SourceConfig sourceFields;

private final Map<String, RuntimeField> runtimeMappings;

Expand All @@ -97,7 +99,7 @@ private Source(Builder builder) {
this.size = builder.size;
this.slice = builder.slice;
this.sort = ApiTypeHelper.unmodifiable(builder.sort);
this.sourceFields = ApiTypeHelper.unmodifiable(builder.sourceFields);
this.sourceFields = builder.sourceFields;
this.runtimeMappings = ApiTypeHelper.unmodifiable(builder.runtimeMappings);

}
Expand Down Expand Up @@ -185,7 +187,8 @@ public final List<SortOptions> sort() {
* <p>
* API name: {@code _source}
*/
public final List<String> sourceFields() {
@Nullable
public final SourceConfig sourceFields() {
return this.sourceFields;
}

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

}
if (ApiTypeHelper.isDefined(this.sourceFields)) {
if (this.sourceFields != null) {
generator.writeKey("_source");
generator.writeStartArray();
for (String item0 : this.sourceFields) {
generator.write(item0);

}
generator.writeEnd();
this.sourceFields.serialize(generator, mapper);

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

@Nullable
private List<String> sourceFields;
private SourceConfig sourceFields;

@Nullable
private Map<String, RuntimeField> runtimeMappings;
Expand Down Expand Up @@ -499,11 +497,9 @@ public final Builder sort(Function<SortOptions.Builder, ObjectBuilder<SortOption
* select fields.
* <p>
* API name: {@code _source}
* <p>
* Adds all elements of <code>list</code> to <code>sourceFields</code>.
*/
public final Builder sourceFields(List<String> list) {
this.sourceFields = _listAddAll(this.sourceFields, list);
public final Builder sourceFields(@Nullable SourceConfig value) {
this.sourceFields = value;
return this;
}

Expand All @@ -512,12 +508,9 @@ public final Builder sourceFields(List<String> list) {
* select fields.
* <p>
* API name: {@code _source}
* <p>
* Adds one or more values to <code>sourceFields</code>.
*/
public final Builder sourceFields(String value, String... values) {
this.sourceFields = _listAdd(this.sourceFields, value, values);
return this;
public final Builder sourceFields(Function<SourceConfig.Builder, ObjectBuilder<SourceConfig>> fn) {
return this.sourceFields(fn.apply(new SourceConfig.Builder()).build());
}

/**
Expand Down Expand Up @@ -590,8 +583,7 @@ protected static void setupSourceDeserializer(ObjectDeserializer<Source.Builder>
op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size");
op.add(Builder::slice, SlicedScroll._DESERIALIZER, "slice");
op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort");
op.add(Builder::sourceFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()),
"_source");
op.add(Builder::sourceFields, SourceConfig._DESERIALIZER, "_source");
op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER),
"runtime_mappings");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ public class PhraseSuggester extends SuggesterBase implements FieldSuggesterVari
@Nullable
private final SmoothingModel smoothing;

@Nullable
private final String text;

@Nullable
private final Integer tokenLimit;

Expand All @@ -115,7 +112,6 @@ private PhraseSuggester(Builder builder) {
this.separator = builder.separator;
this.shardSize = builder.shardSize;
this.smoothing = builder.smoothing;
this.text = builder.text;
this.tokenLimit = builder.tokenLimit;

}
Expand Down Expand Up @@ -255,16 +251,6 @@ public final SmoothingModel smoothing() {
return this.smoothing;
}

/**
* The text/query to provide suggestions for.
* <p>
* API name: {@code text}
*/
@Nullable
public final String text() {
return this.text;
}

/**
* API name: {@code token_limit}
*/
Expand Down Expand Up @@ -335,11 +321,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("smoothing");
this.smoothing.serialize(generator, mapper);

}
if (this.text != null) {
generator.writeKey("text");
generator.write(this.text);

}
if (this.tokenLimit != null) {
generator.writeKey("token_limit");
Expand Down Expand Up @@ -391,9 +372,6 @@ public static class Builder extends SuggesterBase.AbstractBuilder<Builder>
@Nullable
private SmoothingModel smoothing;

@Nullable
private String text;

@Nullable
private Integer tokenLimit;

Expand All @@ -411,7 +389,6 @@ private Builder(PhraseSuggester instance) {
this.separator = instance.separator;
this.shardSize = instance.shardSize;
this.smoothing = instance.smoothing;
this.text = instance.text;
this.tokenLimit = instance.tokenLimit;

}
Expand Down Expand Up @@ -610,16 +587,6 @@ public final Builder smoothing(SmoothingModelVariant value) {
return this;
}

/**
* The text/query to provide suggestions for.
* <p>
* API name: {@code text}
*/
public final Builder text(@Nullable String value) {
this.text = value;
return this;
}

/**
* API name: {@code token_limit}
*/
Expand Down Expand Up @@ -674,7 +641,6 @@ protected static void setupPhraseSuggesterDeserializer(ObjectDeserializer<Phrase
op.add(Builder::separator, JsonpDeserializer.stringDeserializer(), "separator");
op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size");
op.add(Builder::smoothing, SmoothingModel._DESERIALIZER, "smoothing");
op.add(Builder::text, JsonpDeserializer.stringDeserializer(), "text");
op.add(Builder::tokenLimit, JsonpDeserializer.integerDeserializer(), "token_limit");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.lang.Boolean;
import java.lang.Float;
import java.lang.Integer;
import java.lang.String;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -93,9 +92,6 @@ public class TermSuggester extends SuggesterBase implements FieldSuggesterVarian
@Nullable
private final SuggestMode suggestMode;

@Nullable
private final String text;

// ---------------------------------------------------------------------------------------------

private TermSuggester(Builder builder) {
Expand All @@ -112,7 +108,6 @@ private TermSuggester(Builder builder) {
this.sort = builder.sort;
this.stringDistance = builder.stringDistance;
this.suggestMode = builder.suggestMode;
this.text = builder.text;

}

Expand Down Expand Up @@ -252,16 +247,6 @@ public final SuggestMode suggestMode() {
return this.suggestMode;
}

/**
* The suggest text. Needs to be set globally or per suggestion.
* <p>
* API name: {@code text}
*/
@Nullable
public final String text() {
return this.text;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

super.serializeInternal(generator, mapper);
Expand Down Expand Up @@ -317,11 +302,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("suggest_mode");
this.suggestMode.serialize(generator, mapper);
}
if (this.text != null) {
generator.writeKey("text");
generator.write(this.text);

}

}

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

@Nullable
private String text;

public Builder() {
}
private Builder(TermSuggester instance) {
Expand All @@ -382,7 +359,6 @@ private Builder(TermSuggester instance) {
this.sort = instance.sort;
this.stringDistance = instance.stringDistance;
this.suggestMode = instance.suggestMode;
this.text = instance.text;

}
/**
Expand Down Expand Up @@ -509,16 +485,6 @@ public final Builder suggestMode(@Nullable SuggestMode value) {
return this;
}

/**
* The suggest text. Needs to be set globally or per suggestion.
* <p>
* API name: {@code text}
*/
public final Builder text(@Nullable String value) {
this.text = value;
return this;
}

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -564,7 +530,6 @@ protected static void setupTermSuggesterDeserializer(ObjectDeserializer<TermSugg
op.add(Builder::sort, SuggestSort._DESERIALIZER, "sort");
op.add(Builder::stringDistance, StringDistance._DESERIALIZER, "string_distance");
op.add(Builder::suggestMode, SuggestMode._DESERIALIZER, "suggest_mode");
op.add(Builder::text, JsonpDeserializer.stringDeserializer(), "text");

}

Expand Down
Loading
Loading