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 @@ -95,6 +95,9 @@ public class KnnSearch implements JsonpSerializable {
@Nullable
private final RescoreVector rescoreVector;

@Nullable
private final String queryName;

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

private KnnSearch(Builder builder) {
Expand All @@ -110,6 +113,7 @@ private KnnSearch(Builder builder) {
this.similarity = builder.similarity;
this.innerHits = builder.innerHits;
this.rescoreVector = builder.rescoreVector;
this.queryName = builder.queryName;

}

Expand Down Expand Up @@ -226,6 +230,14 @@ public final RescoreVector rescoreVector() {
return this.rescoreVector;
}

/**
* API name: {@code _name}
*/
@Nullable
public final String queryName() {
return this.queryName;
}

/**
* Serialize this object to JSON.
*/
Expand Down Expand Up @@ -300,6 +312,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
this.rescoreVector.serialize(generator, mapper);

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

}

}

Expand Down Expand Up @@ -347,6 +364,9 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
@Nullable
private RescoreVector rescoreVector;

@Nullable
private String queryName;

public Builder() {
}
private Builder(KnnSearch instance) {
Expand All @@ -361,6 +381,7 @@ private Builder(KnnSearch instance) {
this.similarity = instance.similarity;
this.innerHits = instance.innerHits;
this.rescoreVector = instance.rescoreVector;
this.queryName = instance.queryName;

}
/**
Expand Down Expand Up @@ -569,6 +590,14 @@ public final Builder rescoreVector(Function<RescoreVector.Builder, ObjectBuilder
return this.rescoreVector(fn.apply(new RescoreVector.Builder()).build());
}

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

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -615,6 +644,7 @@ protected static void setupKnnSearchDeserializer(ObjectDeserializer<KnnSearch.Bu
op.add(Builder::similarity, JsonpDeserializer.floatDeserializer(), "similarity");
op.add(Builder::innerHits, InnerHits._DESERIALIZER, "inner_hits");
op.add(Builder::rescoreVector, RescoreVector._DESERIALIZER, "rescore_vector");
op.add(Builder::queryName, JsonpDeserializer.stringDeserializer(), "_name");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

package co.elastic.clients.elasticsearch._types;

import co.elastic.clients.elasticsearch._types.aggregations.MultiTermLookup;
import co.elastic.clients.elasticsearch._types.aggregations.MultiTermLookupVariant;
import co.elastic.clients.elasticsearch._types.query_dsl.IntervalsFilter;
import co.elastic.clients.elasticsearch._types.query_dsl.IntervalsFilterVariant;
import co.elastic.clients.json.JsonData;
Expand Down Expand Up @@ -61,7 +63,7 @@
* @see <a href="../doc-files/api-spec.html#_types.Script">API specification</a>
*/
@JsonpDeserializable
public class Script implements IntervalsFilterVariant, JsonpSerializable {
public class Script implements IntervalsFilterVariant, MultiTermLookupVariant, JsonpSerializable {
@Nullable
private final ScriptSource source;

Expand Down Expand Up @@ -99,6 +101,14 @@ public IntervalsFilter.Kind _intervalsFilterKind() {
return IntervalsFilter.Kind.Script;
}

/**
* MultiTermLookup variant kind.
*/
@Override
public MultiTermLookup.Kind _multiTermLookupKind() {
return MultiTermLookup.Kind.Script;
}

/**
* The script source.
* <p>
Expand Down
Loading