Skip to content

Commit 5dcef29

Browse files
committed
Bump version
1 parent 79abcac commit 5dcef29

File tree

15 files changed

+789
-321
lines changed

15 files changed

+789
-321
lines changed

config/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.12.2
1+
8.12.3

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package co.elastic.clients.elasticsearch._types;
2121

2222
import co.elastic.clients.elasticsearch._types.query_dsl.Query;
23+
import co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant;
2324
import co.elastic.clients.json.JsonpDeserializable;
2425
import co.elastic.clients.json.JsonpDeserializer;
2526
import co.elastic.clients.json.JsonpMapper;
@@ -62,7 +63,7 @@
6263
* specification</a>
6364
*/
6465
@JsonpDeserializable
65-
public class KnnQuery implements JsonpSerializable {
66+
public class KnnQuery implements QueryVariant, JsonpSerializable {
6667
private final String field;
6768

6869
private final List<Float> queryVector;
@@ -101,6 +102,14 @@ public static KnnQuery of(Function<Builder, ObjectBuilder<KnnQuery>> fn) {
101102
return fn.apply(new Builder()).build();
102103
}
103104

105+
/**
106+
* Query variant kind.
107+
*/
108+
@Override
109+
public Query.Kind _queryKind() {
110+
return Query.Kind.Knn;
111+
}
112+
104113
/**
105114
* Required - The name of the vector field to search against
106115
* <p>

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

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import co.elastic.clients.json.JsonpMapper;
2525
import co.elastic.clients.json.ObjectBuilderDeserializer;
2626
import co.elastic.clients.json.ObjectDeserializer;
27-
import co.elastic.clients.util.ApiTypeHelper;
2827
import co.elastic.clients.util.ObjectBuilder;
2928
import jakarta.json.stream.JsonGenerator;
3029
import java.lang.Boolean;
@@ -59,27 +58,31 @@
5958
*/
6059
@JsonpDeserializable
6160
public class PathHierarchyTokenizer extends TokenizerBase implements TokenizerDefinitionVariant {
62-
private final int bufferSize;
61+
@Nullable
62+
private final Integer bufferSize;
6363

64+
@Nullable
6465
private final String delimiter;
6566

6667
@Nullable
6768
private final String replacement;
6869

69-
private final boolean reverse;
70+
@Nullable
71+
private final Boolean reverse;
7072

71-
private final int skip;
73+
@Nullable
74+
private final Integer skip;
7275

7376
// ---------------------------------------------------------------------------------------------
7477

7578
private PathHierarchyTokenizer(Builder builder) {
7679
super(builder);
7780

78-
this.bufferSize = ApiTypeHelper.requireNonNull(builder.bufferSize, this, "bufferSize");
79-
this.delimiter = ApiTypeHelper.requireNonNull(builder.delimiter, this, "delimiter");
81+
this.bufferSize = builder.bufferSize;
82+
this.delimiter = builder.delimiter;
8083
this.replacement = builder.replacement;
81-
this.reverse = ApiTypeHelper.requireNonNull(builder.reverse, this, "reverse");
82-
this.skip = ApiTypeHelper.requireNonNull(builder.skip, this, "skip");
84+
this.reverse = builder.reverse;
85+
this.skip = builder.skip;
8386

8487
}
8588

@@ -96,15 +99,17 @@ public TokenizerDefinition.Kind _tokenizerDefinitionKind() {
9699
}
97100

98101
/**
99-
* Required - API name: {@code buffer_size}
102+
* API name: {@code buffer_size}
100103
*/
101-
public final int bufferSize() {
104+
@Nullable
105+
public final Integer bufferSize() {
102106
return this.bufferSize;
103107
}
104108

105109
/**
106-
* Required - API name: {@code delimiter}
110+
* API name: {@code delimiter}
107111
*/
112+
@Nullable
108113
public final String delimiter() {
109114
return this.delimiter;
110115
}
@@ -118,39 +123,50 @@ public final String replacement() {
118123
}
119124

120125
/**
121-
* Required - API name: {@code reverse}
126+
* API name: {@code reverse}
122127
*/
123-
public final boolean reverse() {
128+
@Nullable
129+
public final Boolean reverse() {
124130
return this.reverse;
125131
}
126132

127133
/**
128-
* Required - API name: {@code skip}
134+
* API name: {@code skip}
129135
*/
130-
public final int skip() {
136+
@Nullable
137+
public final Integer skip() {
131138
return this.skip;
132139
}
133140

134141
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
135142

136143
generator.write("type", "path_hierarchy");
137144
super.serializeInternal(generator, mapper);
138-
generator.writeKey("buffer_size");
139-
generator.write(this.bufferSize);
145+
if (this.bufferSize != null) {
146+
generator.writeKey("buffer_size");
147+
generator.write(this.bufferSize);
140148

141-
generator.writeKey("delimiter");
142-
generator.write(this.delimiter);
149+
}
150+
if (this.delimiter != null) {
151+
generator.writeKey("delimiter");
152+
generator.write(this.delimiter);
143153

154+
}
144155
if (this.replacement != null) {
145156
generator.writeKey("replacement");
146157
generator.write(this.replacement);
147158

148159
}
149-
generator.writeKey("reverse");
150-
generator.write(this.reverse);
160+
if (this.reverse != null) {
161+
generator.writeKey("reverse");
162+
generator.write(this.reverse);
163+
164+
}
165+
if (this.skip != null) {
166+
generator.writeKey("skip");
167+
generator.write(this.skip);
151168

152-
generator.writeKey("skip");
153-
generator.write(this.skip);
169+
}
154170

155171
}
156172

@@ -163,29 +179,33 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
163179
public static class Builder extends TokenizerBase.AbstractBuilder<Builder>
164180
implements
165181
ObjectBuilder<PathHierarchyTokenizer> {
182+
@Nullable
166183
private Integer bufferSize;
167184

185+
@Nullable
168186
private String delimiter;
169187

170188
@Nullable
171189
private String replacement;
172190

191+
@Nullable
173192
private Boolean reverse;
174193

194+
@Nullable
175195
private Integer skip;
176196

177197
/**
178-
* Required - API name: {@code buffer_size}
198+
* API name: {@code buffer_size}
179199
*/
180-
public final Builder bufferSize(int value) {
200+
public final Builder bufferSize(@Nullable Integer value) {
181201
this.bufferSize = value;
182202
return this;
183203
}
184204

185205
/**
186-
* Required - API name: {@code delimiter}
206+
* API name: {@code delimiter}
187207
*/
188-
public final Builder delimiter(String value) {
208+
public final Builder delimiter(@Nullable String value) {
189209
this.delimiter = value;
190210
return this;
191211
}
@@ -199,17 +219,17 @@ public final Builder replacement(@Nullable String value) {
199219
}
200220

201221
/**
202-
* Required - API name: {@code reverse}
222+
* API name: {@code reverse}
203223
*/
204-
public final Builder reverse(boolean value) {
224+
public final Builder reverse(@Nullable Boolean value) {
205225
this.reverse = value;
206226
return this;
207227
}
208228

209229
/**
210-
* Required - API name: {@code skip}
230+
* API name: {@code skip}
211231
*/
212-
public final Builder skip(int value) {
232+
public final Builder skip(@Nullable Integer value) {
213233
this.skip = value;
214234
return this;
215235
}

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import co.elastic.clients.util.ApiTypeHelper;
3030
import co.elastic.clients.util.ObjectBuilder;
3131
import jakarta.json.stream.JsonGenerator;
32+
import java.lang.Boolean;
3233
import java.lang.String;
3334
import java.util.Objects;
3435
import java.util.function.Function;
@@ -71,6 +72,9 @@ public class GeoDistanceQuery extends QueryBase implements QueryVariant {
7172
@Nullable
7273
private final GeoValidationMethod validationMethod;
7374

75+
@Nullable
76+
private final Boolean ignoreUnmapped;
77+
7478
// ---------------------------------------------------------------------------------------------
7579

7680
private GeoDistanceQuery(Builder builder) {
@@ -81,6 +85,7 @@ private GeoDistanceQuery(Builder builder) {
8185
this.distance = ApiTypeHelper.requireNonNull(builder.distance, this, "distance");
8286
this.distanceType = builder.distanceType;
8387
this.validationMethod = builder.validationMethod;
88+
this.ignoreUnmapped = builder.ignoreUnmapped;
8489

8590
}
8691

@@ -143,6 +148,18 @@ public final GeoValidationMethod validationMethod() {
143148
return this.validationMethod;
144149
}
145150

151+
/**
152+
* Set to <code>true</code> to ignore an unmapped field and not match any
153+
* documents for this query. Set to <code>false</code> to throw an exception if
154+
* the field is not mapped.
155+
* <p>
156+
* API name: {@code ignore_unmapped}
157+
*/
158+
@Nullable
159+
public final Boolean ignoreUnmapped() {
160+
return this.ignoreUnmapped;
161+
}
162+
146163
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
147164
generator.writeKey(this.field);
148165
this.location.serialize(generator, mapper);
@@ -159,6 +176,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
159176
generator.writeKey("validation_method");
160177
this.validationMethod.serialize(generator, mapper);
161178
}
179+
if (this.ignoreUnmapped != null) {
180+
generator.writeKey("ignore_unmapped");
181+
generator.write(this.ignoreUnmapped);
182+
183+
}
162184

163185
}
164186

@@ -204,6 +226,9 @@ public final Builder location(Function<GeoLocation.Builder, ObjectBuilder<GeoLoc
204226
@Nullable
205227
private GeoValidationMethod validationMethod;
206228

229+
@Nullable
230+
private Boolean ignoreUnmapped;
231+
207232
/**
208233
* Required - The radius of the circle centred on the specified location. Points
209234
* which fall into this circle are considered to be matches.
@@ -238,6 +263,18 @@ public final Builder validationMethod(@Nullable GeoValidationMethod value) {
238263
return this;
239264
}
240265

266+
/**
267+
* Set to <code>true</code> to ignore an unmapped field and not match any
268+
* documents for this query. Set to <code>false</code> to throw an exception if
269+
* the field is not mapped.
270+
* <p>
271+
* API name: {@code ignore_unmapped}
272+
*/
273+
public final Builder ignoreUnmapped(@Nullable Boolean value) {
274+
this.ignoreUnmapped = value;
275+
return this;
276+
}
277+
241278
@Override
242279
protected Builder self() {
243280
return this;
@@ -269,6 +306,7 @@ protected static void setupGeoDistanceQueryDeserializer(ObjectDeserializer<GeoDi
269306
op.add(Builder::distance, JsonpDeserializer.stringDeserializer(), "distance");
270307
op.add(Builder::distanceType, GeoDistanceType._DESERIALIZER, "distance_type");
271308
op.add(Builder::validationMethod, GeoValidationMethod._DESERIALIZER, "validation_method");
309+
op.add(Builder::ignoreUnmapped, JsonpDeserializer.booleanDeserializer(), "ignore_unmapped");
272310

273311
op.setUnknownFieldHandler((builder, name, parser, mapper) -> {
274312
builder.field(name);

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package co.elastic.clients.elasticsearch._types.query_dsl;
2121

22+
import co.elastic.clients.elasticsearch._types.KnnQuery;
2223
import co.elastic.clients.elasticsearch._types.aggregations.Aggregation;
2324
import co.elastic.clients.elasticsearch._types.aggregations.AggregationVariant;
2425
import co.elastic.clients.json.JsonData;
@@ -115,6 +116,8 @@ public enum Kind implements JsonEnum {
115116

116117
Intervals("intervals"),
117118

119+
Knn("knn"),
120+
118121
Match("match"),
119122

120123
MatchAll("match_all"),
@@ -558,6 +561,23 @@ public IntervalsQuery intervals() {
558561
return TaggedUnionUtils.get(this, Kind.Intervals);
559562
}
560563

564+
/**
565+
* Is this variant instance of kind {@code knn}?
566+
*/
567+
public boolean isKnn() {
568+
return _kind == Kind.Knn;
569+
}
570+
571+
/**
572+
* Get the {@code knn} variant value.
573+
*
574+
* @throws IllegalStateException
575+
* if the current variant is not of the {@code knn} kind.
576+
*/
577+
public KnnQuery knn() {
578+
return TaggedUnionUtils.get(this, Kind.Knn);
579+
}
580+
561581
/**
562582
* Is this variant instance of kind {@code match}?
563583
*/
@@ -1453,6 +1473,16 @@ public ObjectBuilder<Query> intervals(Function<IntervalsQuery.Builder, ObjectBui
14531473
return this.intervals(fn.apply(new IntervalsQuery.Builder()).build());
14541474
}
14551475

1476+
public ObjectBuilder<Query> knn(KnnQuery v) {
1477+
this._kind = Kind.Knn;
1478+
this._value = v;
1479+
return this;
1480+
}
1481+
1482+
public ObjectBuilder<Query> knn(Function<KnnQuery.Builder, ObjectBuilder<KnnQuery>> fn) {
1483+
return this.knn(fn.apply(new KnnQuery.Builder()).build());
1484+
}
1485+
14561486
public ObjectBuilder<Query> match(MatchQuery v) {
14571487
this._kind = Kind.Match;
14581488
this._value = v;
@@ -1888,6 +1918,7 @@ protected static void setupQueryDeserializer(ObjectDeserializer<Builder> op) {
18881918
op.add(Builder::hasParent, HasParentQuery._DESERIALIZER, "has_parent");
18891919
op.add(Builder::ids, IdsQuery._DESERIALIZER, "ids");
18901920
op.add(Builder::intervals, IntervalsQuery._DESERIALIZER, "intervals");
1921+
op.add(Builder::knn, KnnQuery._DESERIALIZER, "knn");
18911922
op.add(Builder::match, MatchQuery._DESERIALIZER, "match");
18921923
op.add(Builder::matchAll, MatchAllQuery._DESERIALIZER, "match_all");
18931924
op.add(Builder::matchBoolPrefix, MatchBoolPrefixQuery._DESERIALIZER, "match_bool_prefix");

0 commit comments

Comments
 (0)