Skip to content

Fixes from pr 2440 #758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2024
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 @@ -82,6 +82,7 @@ public class InlineGet<TDocument> implements JsonpSerializable {
@Nullable
private final String routing;

@Nullable
private final TDocument source;

@Nullable
Expand All @@ -98,7 +99,7 @@ private InlineGet(Builder<TDocument> builder) {
this.seqNo = builder.seqNo;
this.primaryTerm = builder.primaryTerm;
this.routing = builder.routing;
this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source");
this.source = builder.source;
this.tDocumentSerializer = builder.tDocumentSerializer;

}
Expand Down Expand Up @@ -154,8 +155,9 @@ public final String routing() {
}

/**
* Required - API name: {@code _source}
* API name: {@code _source}
*/
@Nullable
public final TDocument source() {
return this.source;
}
Expand Down Expand Up @@ -206,8 +208,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.routing);

}
generator.writeKey("_source");
JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper);
if (this.source != null) {
generator.writeKey("_source");
JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper);

}

}

Expand Down Expand Up @@ -262,6 +267,7 @@ public final Builder<TDocument> metadata(String key, JsonData value) {
@Nullable
private String routing;

@Nullable
private TDocument source;

@Nullable
Expand Down Expand Up @@ -320,9 +326,9 @@ public final Builder<TDocument> routing(@Nullable String value) {
}

/**
* Required - API name: {@code _source}
* API name: {@code _source}
*/
public final Builder<TDocument> source(TDocument value) {
public final Builder<TDocument> source(@Nullable TDocument value) {
this.source = value;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ApiTypeHelper;
import co.elastic.clients.util.ObjectBuilder;
import jakarta.json.stream.JsonGenerator;
import java.lang.Boolean;
Expand Down Expand Up @@ -59,7 +58,8 @@
*/
@JsonpDeserializable
public class DenseVectorProperty extends PropertyBase implements PropertyVariant {
private final int dims;
@Nullable
private final Integer dims;

@Nullable
private final String similarity;
Expand All @@ -75,7 +75,7 @@ public class DenseVectorProperty extends PropertyBase implements PropertyVariant
private DenseVectorProperty(Builder builder) {
super(builder);

this.dims = ApiTypeHelper.requireNonNull(builder.dims, this, "dims");
this.dims = builder.dims;
this.similarity = builder.similarity;
this.index = builder.index;
this.indexOptions = builder.indexOptions;
Expand All @@ -95,9 +95,10 @@ public Property.Kind _propertyKind() {
}

/**
* Required - API name: {@code dims}
* API name: {@code dims}
*/
public final int dims() {
@Nullable
public final Integer dims() {
return this.dims;
}

Expand Down Expand Up @@ -129,9 +130,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "dense_vector");
super.serializeInternal(generator, mapper);
generator.writeKey("dims");
generator.write(this.dims);
if (this.dims != null) {
generator.writeKey("dims");
generator.write(this.dims);

}
if (this.similarity != null) {
generator.writeKey("similarity");
generator.write(this.similarity);
Expand Down Expand Up @@ -159,6 +162,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
public static class Builder extends PropertyBase.AbstractBuilder<Builder>
implements
ObjectBuilder<DenseVectorProperty> {
@Nullable
private Integer dims;

@Nullable
Expand All @@ -171,9 +175,9 @@ public static class Builder extends PropertyBase.AbstractBuilder<Builder>
private DenseVectorIndexOptions indexOptions;

/**
* Required - API name: {@code dims}
* API name: {@code dims}
*/
public final Builder dims(int value) {
public final Builder dims(@Nullable Integer value) {
this.dims = value;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package co.elastic.clients.elasticsearch._types.mapping;

import co.elastic.clients.elasticsearch._types.GeoLocation;
import co.elastic.clients.elasticsearch._types.Script;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
Expand Down Expand Up @@ -66,6 +67,15 @@ public class GeoPointProperty extends DocValuesPropertyBase implements PropertyV
@Nullable
private final GeoLocation nullValue;

@Nullable
private final Boolean index;

@Nullable
private final OnScriptError onScriptError;

@Nullable
private final Script script;

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

private GeoPointProperty(Builder builder) {
Expand All @@ -74,6 +84,9 @@ private GeoPointProperty(Builder builder) {
this.ignoreMalformed = builder.ignoreMalformed;
this.ignoreZValue = builder.ignoreZValue;
this.nullValue = builder.nullValue;
this.index = builder.index;
this.onScriptError = builder.onScriptError;
this.script = builder.script;

}

Expand Down Expand Up @@ -113,6 +126,30 @@ public final GeoLocation nullValue() {
return this.nullValue;
}

/**
* API name: {@code index}
*/
@Nullable
public final Boolean index() {
return this.index;
}

/**
* API name: {@code on_script_error}
*/
@Nullable
public final OnScriptError onScriptError() {
return this.onScriptError;
}

/**
* API name: {@code script}
*/
@Nullable
public final Script script() {
return this.script;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "geo_point");
Expand All @@ -132,6 +169,20 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
this.nullValue.serialize(generator, mapper);

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

}
if (this.onScriptError != null) {
generator.writeKey("on_script_error");
this.onScriptError.serialize(generator, mapper);
}
if (this.script != null) {
generator.writeKey("script");
this.script.serialize(generator, mapper);

}

}

Expand All @@ -153,6 +204,15 @@ public static class Builder extends DocValuesPropertyBase.AbstractBuilder<Builde
@Nullable
private GeoLocation nullValue;

@Nullable
private Boolean index;

@Nullable
private OnScriptError onScriptError;

@Nullable
private Script script;

/**
* API name: {@code ignore_malformed}
*/
Expand Down Expand Up @@ -184,6 +244,37 @@ public final Builder nullValue(Function<GeoLocation.Builder, ObjectBuilder<GeoLo
return this.nullValue(fn.apply(new GeoLocation.Builder()).build());
}

/**
* API name: {@code index}
*/
public final Builder index(@Nullable Boolean value) {
this.index = value;
return this;
}

/**
* API name: {@code on_script_error}
*/
public final Builder onScriptError(@Nullable OnScriptError value) {
this.onScriptError = value;
return this;
}

/**
* API name: {@code script}
*/
public final Builder script(@Nullable Script value) {
this.script = value;
return this;
}

/**
* API name: {@code script}
*/
public final Builder script(Function<Script.Builder, ObjectBuilder<Script>> fn) {
return this.script(fn.apply(new Script.Builder()).build());
}

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -215,6 +306,9 @@ protected static void setupGeoPointPropertyDeserializer(ObjectDeserializer<GeoPo
op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed");
op.add(Builder::ignoreZValue, JsonpDeserializer.booleanDeserializer(), "ignore_z_value");
op.add(Builder::nullValue, GeoLocation._DESERIALIZER, "null_value");
op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index");
op.add(Builder::onScriptError, OnScriptError._DESERIALIZER, "on_script_error");
op.add(Builder::script, Script._DESERIALIZER, "script");

op.ignore("type");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ObjectBuilder;
import jakarta.json.stream.JsonGenerator;
import java.lang.Boolean;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nullable;

//----------------------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
Expand All @@ -54,11 +56,16 @@
*/
@JsonpDeserializable
public class RankFeaturesProperty extends PropertyBase implements PropertyVariant {
@Nullable
private final Boolean positiveScoreImpact;

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

private RankFeaturesProperty(Builder builder) {
super(builder);

this.positiveScoreImpact = builder.positiveScoreImpact;

}

public static RankFeaturesProperty of(Function<Builder, ObjectBuilder<RankFeaturesProperty>> fn) {
Expand All @@ -73,10 +80,23 @@ public Property.Kind _propertyKind() {
return Property.Kind.RankFeatures;
}

/**
* API name: {@code positive_score_impact}
*/
@Nullable
public final Boolean positiveScoreImpact() {
return this.positiveScoreImpact;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.write("type", "rank_features");
super.serializeInternal(generator, mapper);
if (this.positiveScoreImpact != null) {
generator.writeKey("positive_score_impact");
generator.write(this.positiveScoreImpact);

}

}

Expand All @@ -89,6 +109,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
public static class Builder extends PropertyBase.AbstractBuilder<Builder>
implements
ObjectBuilder<RankFeaturesProperty> {
@Nullable
private Boolean positiveScoreImpact;

/**
* API name: {@code positive_score_impact}
*/
public final Builder positiveScoreImpact(@Nullable Boolean value) {
this.positiveScoreImpact = value;
return this;
}

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -117,6 +148,7 @@ public RankFeaturesProperty build() {

protected static void setupRankFeaturesPropertyDeserializer(ObjectDeserializer<RankFeaturesProperty.Builder> op) {
PropertyBase.setupPropertyBaseDeserializer(op);
op.add(Builder::positiveScoreImpact, JsonpDeserializer.booleanDeserializer(), "positive_score_impact");

op.ignore("type");
}
Expand Down
Loading