Skip to content

Commit 0a255f1

Browse files
committed
[codegen] update to latest spec
1 parent da2d0d2 commit 0a255f1

File tree

111 files changed

+5957
-1494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+5957
-1494
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java

Lines changed: 283 additions & 86 deletions
Large diffs are not rendered by default.

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java

Lines changed: 283 additions & 86 deletions
Large diffs are not rendered by default.

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Retriever.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ public enum Kind implements JsonEnum {
7777

7878
Rrf("rrf"),
7979

80+
TextSimilarityReranker("text_similarity_reranker"),
81+
8082
;
8183

8284
private final String jsonValue;
@@ -173,6 +175,24 @@ public RRFRetriever rrf() {
173175
return TaggedUnionUtils.get(this, Kind.Rrf);
174176
}
175177

178+
/**
179+
* Is this variant instance of kind {@code text_similarity_reranker}?
180+
*/
181+
public boolean isTextSimilarityReranker() {
182+
return _kind == Kind.TextSimilarityReranker;
183+
}
184+
185+
/**
186+
* Get the {@code text_similarity_reranker} variant value.
187+
*
188+
* @throws IllegalStateException
189+
* if the current variant is not of the
190+
* {@code text_similarity_reranker} kind.
191+
*/
192+
public TextSimilarityReranker textSimilarityReranker() {
193+
return TaggedUnionUtils.get(this, Kind.TextSimilarityReranker);
194+
}
195+
176196
@Override
177197
@SuppressWarnings("unchecked")
178198
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
@@ -232,6 +252,17 @@ public ObjectBuilder<Retriever> rrf(Function<RRFRetriever.Builder, ObjectBuilder
232252
return this.rrf(fn.apply(new RRFRetriever.Builder()).build());
233253
}
234254

255+
public ObjectBuilder<Retriever> textSimilarityReranker(TextSimilarityReranker v) {
256+
this._kind = Kind.TextSimilarityReranker;
257+
this._value = v;
258+
return this;
259+
}
260+
261+
public ObjectBuilder<Retriever> textSimilarityReranker(
262+
Function<TextSimilarityReranker.Builder, ObjectBuilder<TextSimilarityReranker>> fn) {
263+
return this.textSimilarityReranker(fn.apply(new TextSimilarityReranker.Builder()).build());
264+
}
265+
235266
public Retriever build() {
236267
_checkSingleUse();
237268
return new Retriever(this);
@@ -244,6 +275,7 @@ protected static void setupRetrieverDeserializer(ObjectDeserializer<Builder> op)
244275
op.add(Builder::standard, StandardRetriever._DESERIALIZER, "standard");
245276
op.add(Builder::knn, KnnRetriever._DESERIALIZER, "knn");
246277
op.add(Builder::rrf, RRFRetriever._DESERIALIZER, "rrf");
278+
op.add(Builder::textSimilarityReranker, TextSimilarityReranker._DESERIALIZER, "text_similarity_reranker");
247279

248280
}
249281

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverBase.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import co.elastic.clients.util.ObjectBuilder;
3232
import co.elastic.clients.util.WithJsonObjectBuilderBase;
3333
import jakarta.json.stream.JsonGenerator;
34+
import java.lang.Float;
3435
import java.util.List;
3536
import java.util.Objects;
3637
import java.util.function.Function;
@@ -62,11 +63,15 @@
6263
public abstract class RetrieverBase implements JsonpSerializable {
6364
private final List<Query> filter;
6465

66+
@Nullable
67+
private final Float minScore;
68+
6569
// ---------------------------------------------------------------------------------------------
6670

6771
protected RetrieverBase(AbstractBuilder<?> builder) {
6872

6973
this.filter = ApiTypeHelper.unmodifiable(builder.filter);
74+
this.minScore = builder.minScore;
7075

7176
}
7277

@@ -79,6 +84,17 @@ public final List<Query> filter() {
7984
return this.filter;
8085
}
8186

87+
/**
88+
* Minimum _score for matching documents. Documents with a lower _score are not
89+
* included in the top documents.
90+
* <p>
91+
* API name: {@code min_score}
92+
*/
93+
@Nullable
94+
public final Float minScore() {
95+
return this.minScore;
96+
}
97+
8298
/**
8399
* Serialize this object to JSON.
84100
*/
@@ -100,6 +116,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
100116
generator.writeEnd();
101117

102118
}
119+
if (this.minScore != null) {
120+
generator.writeKey("min_score");
121+
generator.write(this.minScore);
122+
123+
}
103124

104125
}
105126

@@ -114,6 +135,9 @@ public abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<Bu
114135
@Nullable
115136
private List<Query> filter;
116137

138+
@Nullable
139+
private Float minScore;
140+
117141
/**
118142
* Query to filter the documents that can match.
119143
* <p>
@@ -149,6 +173,17 @@ public final BuilderT filter(Function<Query.Builder, ObjectBuilder<Query>> fn) {
149173
return filter(fn.apply(new Query.Builder()).build());
150174
}
151175

176+
/**
177+
* Minimum _score for matching documents. Documents with a lower _score are not
178+
* included in the top documents.
179+
* <p>
180+
* API name: {@code min_score}
181+
*/
182+
public final BuilderT minScore(@Nullable Float value) {
183+
this.minScore = value;
184+
return self();
185+
}
186+
152187
protected abstract BuilderT self();
153188

154189
}
@@ -158,6 +193,7 @@ protected static <BuilderT extends AbstractBuilder<BuilderT>> void setupRetrieve
158193
ObjectDeserializer<BuilderT> op) {
159194

160195
op.add(AbstractBuilder::filter, JsonpDeserializer.arrayDeserializer(Query._DESERIALIZER), "filter");
196+
op.add(AbstractBuilder::minScore, JsonpDeserializer.floatDeserializer(), "min_score");
161197

162198
}
163199

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverBuilders.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,23 @@ public static Retriever rrf(Function<RRFRetriever.Builder, ObjectBuilder<RRFRetr
9696
return builder.build();
9797
}
9898

99+
/**
100+
* Creates a builder for the {@link TextSimilarityReranker
101+
* text_similarity_reranker} {@code Retriever} variant.
102+
*/
103+
public static TextSimilarityReranker.Builder textSimilarityReranker() {
104+
return new TextSimilarityReranker.Builder();
105+
}
106+
107+
/**
108+
* Creates a Retriever of the {@link TextSimilarityReranker
109+
* text_similarity_reranker} {@code Retriever} variant.
110+
*/
111+
public static Retriever textSimilarityReranker(
112+
Function<TextSimilarityReranker.Builder, ObjectBuilder<TextSimilarityReranker>> fn) {
113+
Retriever.Builder builder = new Retriever.Builder();
114+
builder.textSimilarityReranker(fn.apply(new TextSimilarityReranker.Builder()).build());
115+
return builder.build();
116+
}
117+
99118
}

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/StandardRetriever.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import co.elastic.clients.util.ApiTypeHelper;
3030
import co.elastic.clients.util.ObjectBuilder;
3131
import jakarta.json.stream.JsonGenerator;
32-
import java.lang.Float;
3332
import java.lang.Integer;
3433
import java.util.ArrayList;
3534
import java.util.List;
@@ -71,9 +70,6 @@ public class StandardRetriever extends RetrieverBase implements RetrieverVariant
7170

7271
private final List<SortOptions> sort;
7372

74-
@Nullable
75-
private final Float minScore;
76-
7773
@Nullable
7874
private final FieldCollapse collapse;
7975

@@ -86,7 +82,6 @@ private StandardRetriever(Builder builder) {
8682
this.searchAfter = ApiTypeHelper.unmodifiable(builder.searchAfter);
8783
this.terminateAfter = builder.terminateAfter;
8884
this.sort = ApiTypeHelper.unmodifiable(builder.sort);
89-
this.minScore = builder.minScore;
9085
this.collapse = builder.collapse;
9186

9287
}
@@ -141,17 +136,6 @@ public final List<SortOptions> sort() {
141136
return this.sort;
142137
}
143138

144-
/**
145-
* Minimum _score for matching documents. Documents with a lower _score are not
146-
* included in the top documents.
147-
* <p>
148-
* API name: {@code min_score}
149-
*/
150-
@Nullable
151-
public final Float minScore() {
152-
return this.minScore;
153-
}
154-
155139
/**
156140
* Collapses the top documents by a specified key into a single top document per
157141
* key.
@@ -195,11 +179,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
195179
}
196180
generator.writeEnd();
197181

198-
}
199-
if (this.minScore != null) {
200-
generator.writeKey("min_score");
201-
generator.write(this.minScore);
202-
203182
}
204183
if (this.collapse != null) {
205184
generator.writeKey("collapse");
@@ -230,9 +209,6 @@ public static class Builder extends RetrieverBase.AbstractBuilder<Builder>
230209
@Nullable
231210
private List<SortOptions> sort;
232211

233-
@Nullable
234-
private Float minScore;
235-
236212
@Nullable
237213
private FieldCollapse collapse;
238214

@@ -403,17 +379,6 @@ public final Builder sort(Function<SortOptions.Builder, ObjectBuilder<SortOption
403379
return sort(fn.apply(new SortOptions.Builder()).build());
404380
}
405381

406-
/**
407-
* Minimum _score for matching documents. Documents with a lower _score are not
408-
* included in the top documents.
409-
* <p>
410-
* API name: {@code min_score}
411-
*/
412-
public final Builder minScore(@Nullable Float value) {
413-
this.minScore = value;
414-
return this;
415-
}
416-
417382
/**
418383
* Collapses the top documents by a specified key into a single top document per
419384
* key.
@@ -467,7 +432,6 @@ protected static void setupStandardRetrieverDeserializer(ObjectDeserializer<Stan
467432
op.add(Builder::searchAfter, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "search_after");
468433
op.add(Builder::terminateAfter, JsonpDeserializer.integerDeserializer(), "terminate_after");
469434
op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort");
470-
op.add(Builder::minScore, JsonpDeserializer.floatDeserializer(), "min_score");
471435
op.add(Builder::collapse, FieldCollapse._DESERIALIZER, "collapse");
472436

473437
}

0 commit comments

Comments
 (0)