Skip to content

Commit abfbcdb

Browse files
committed
[codegen] update to latest spec
1 parent 7e2c2e8 commit abfbcdb

17 files changed

+1225
-351
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package co.elastic.clients.elasticsearch._types.mapping;
21+
22+
import co.elastic.clients.json.JsonEnum;
23+
import co.elastic.clients.json.JsonpDeserializable;
24+
import co.elastic.clients.json.JsonpDeserializer;
25+
26+
//----------------------------------------------------------------
27+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
28+
//----------------------------------------------------------------
29+
//
30+
// This code is generated from the Elasticsearch API specification
31+
// at https://github.com/elastic/elasticsearch-specification
32+
//
33+
// Manual updates to this file will be lost when the code is
34+
// re-generated.
35+
//
36+
// If you find a property that is missing or wrongly typed, please
37+
// open an issue or a PR on the API specification repository.
38+
//
39+
//----------------------------------------------------------------
40+
41+
/**
42+
*
43+
* @see <a href=
44+
* "../../doc-files/api-spec.html#_types.mapping.DenseVectorElementType">API
45+
* specification</a>
46+
*/
47+
@JsonpDeserializable
48+
public enum DenseVectorElementType implements JsonEnum {
49+
/**
50+
* Indexes a single bit per dimension. Useful for very high-dimensional vectors
51+
* or models that specifically support bit vectors.
52+
* <p>
53+
* NOTE: when using <code>bit</code>, the number of dimensions must be a
54+
* multiple of <code>8</code> and must represent the number of bits.
55+
*/
56+
Bit("bit"),
57+
58+
/**
59+
* Indexes a 1-byte integer value per dimension.
60+
*/
61+
Byte("byte"),
62+
63+
/**
64+
* Indexes a 4-byte floating-point value per dimension.
65+
*/
66+
Float("float"),
67+
68+
;
69+
70+
private final String jsonValue;
71+
72+
DenseVectorElementType(String jsonValue) {
73+
this.jsonValue = jsonValue;
74+
}
75+
76+
public String jsonValue() {
77+
return this.jsonValue;
78+
}
79+
80+
public static final JsonEnum.Deserializer<DenseVectorElementType> _DESERIALIZER = new JsonEnum.Deserializer<>(
81+
DenseVectorElementType.values());
82+
}

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

+107-49
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import jakarta.json.stream.JsonGenerator;
3333
import java.lang.Float;
3434
import java.lang.Integer;
35-
import java.lang.String;
3635
import java.util.Objects;
3736
import java.util.function.Function;
3837
import javax.annotation.Nullable;
@@ -62,25 +61,25 @@
6261
*/
6362
@JsonpDeserializable
6463
public class DenseVectorIndexOptions implements JsonpSerializable {
65-
private final String type;
66-
6764
@Nullable
68-
private final Integer m;
65+
private final Float confidenceInterval;
6966

7067
@Nullable
7168
private final Integer efConstruction;
7269

7370
@Nullable
74-
private final Float confidenceInterval;
71+
private final Integer m;
72+
73+
private final DenseVectorIndexOptionsType type;
7574

7675
// ---------------------------------------------------------------------------------------------
7776

7877
private DenseVectorIndexOptions(Builder builder) {
7978

80-
this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type");
81-
this.m = builder.m;
82-
this.efConstruction = builder.efConstruction;
8379
this.confidenceInterval = builder.confidenceInterval;
80+
this.efConstruction = builder.efConstruction;
81+
this.m = builder.m;
82+
this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type");
8483

8584
}
8685

@@ -89,21 +88,37 @@ public static DenseVectorIndexOptions of(Function<Builder, ObjectBuilder<DenseVe
8988
}
9089

9190
/**
92-
* Required - API name: {@code type}
93-
*/
94-
public final String type() {
95-
return this.type;
96-
}
97-
98-
/**
99-
* API name: {@code m}
91+
* The confidence interval to use when quantizing the vectors. Can be any value
92+
* between and including <code>0.90</code> and <code>1.0</code> or exactly
93+
* <code>0</code>. When the value is <code>0</code>, this indicates that dynamic
94+
* quantiles should be calculated for optimized quantization. When between
95+
* <code>0.90</code> and <code>1.0</code>, this value restricts the values used
96+
* when calculating the quantization thresholds.
97+
* <p>
98+
* For example, a value of <code>0.95</code> will only use the middle
99+
* <code>95%</code> of the values when calculating the quantization thresholds
100+
* (e.g. the highest and lowest <code>2.5%</code> of values will be ignored).
101+
* <p>
102+
* Defaults to <code>1/(dims + 1)</code> for <code>int8</code> quantized vectors
103+
* and <code>0</code> for <code>int4</code> for dynamic quantile calculation.
104+
* <p>
105+
* Only applicable to <code>int8_hnsw</code>, <code>int4_hnsw</code>,
106+
* <code>int8_flat</code>, and <code>int4_flat</code> index types.
107+
* <p>
108+
* API name: {@code confidence_interval}
100109
*/
101110
@Nullable
102-
public final Integer m() {
103-
return this.m;
111+
public final Float confidenceInterval() {
112+
return this.confidenceInterval;
104113
}
105114

106115
/**
116+
* The number of candidates to track while assembling the list of nearest
117+
* neighbors for each new node.
118+
* <p>
119+
* Only applicable to <code>hnsw</code>, <code>int8_hnsw</code>, and
120+
* <code>int4_hnsw</code> index types.
121+
* <p>
107122
* API name: {@code ef_construction}
108123
*/
109124
@Nullable
@@ -112,11 +127,25 @@ public final Integer efConstruction() {
112127
}
113128

114129
/**
115-
* API name: {@code confidence_interval}
130+
* The number of neighbors each node will be connected to in the HNSW graph.
131+
* <p>
132+
* Only applicable to <code>hnsw</code>, <code>int8_hnsw</code>, and
133+
* <code>int4_hnsw</code> index types.
134+
* <p>
135+
* API name: {@code m}
116136
*/
117137
@Nullable
118-
public final Float confidenceInterval() {
119-
return this.confidenceInterval;
138+
public final Integer m() {
139+
return this.m;
140+
}
141+
142+
/**
143+
* Required - The type of kNN algorithm to use.
144+
* <p>
145+
* API name: {@code type}
146+
*/
147+
public final DenseVectorIndexOptionsType type() {
148+
return this.type;
120149
}
121150

122151
/**
@@ -130,24 +159,23 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
130159

131160
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
132161

133-
generator.writeKey("type");
134-
generator.write(this.type);
135-
136-
if (this.m != null) {
137-
generator.writeKey("m");
138-
generator.write(this.m);
162+
if (this.confidenceInterval != null) {
163+
generator.writeKey("confidence_interval");
164+
generator.write(this.confidenceInterval);
139165

140166
}
141167
if (this.efConstruction != null) {
142168
generator.writeKey("ef_construction");
143169
generator.write(this.efConstruction);
144170

145171
}
146-
if (this.confidenceInterval != null) {
147-
generator.writeKey("confidence_interval");
148-
generator.write(this.confidenceInterval);
172+
if (this.m != null) {
173+
generator.writeKey("m");
174+
generator.write(this.m);
149175

150176
}
177+
generator.writeKey("type");
178+
this.type.serialize(generator, mapper);
151179

152180
}
153181

@@ -165,46 +193,76 @@ public String toString() {
165193
public static class Builder extends WithJsonObjectBuilderBase<Builder>
166194
implements
167195
ObjectBuilder<DenseVectorIndexOptions> {
168-
private String type;
169-
170196
@Nullable
171-
private Integer m;
197+
private Float confidenceInterval;
172198

173199
@Nullable
174200
private Integer efConstruction;
175201

176202
@Nullable
177-
private Float confidenceInterval;
203+
private Integer m;
204+
205+
private DenseVectorIndexOptionsType type;
178206

179207
/**
180-
* Required - API name: {@code type}
208+
* The confidence interval to use when quantizing the vectors. Can be any value
209+
* between and including <code>0.90</code> and <code>1.0</code> or exactly
210+
* <code>0</code>. When the value is <code>0</code>, this indicates that dynamic
211+
* quantiles should be calculated for optimized quantization. When between
212+
* <code>0.90</code> and <code>1.0</code>, this value restricts the values used
213+
* when calculating the quantization thresholds.
214+
* <p>
215+
* For example, a value of <code>0.95</code> will only use the middle
216+
* <code>95%</code> of the values when calculating the quantization thresholds
217+
* (e.g. the highest and lowest <code>2.5%</code> of values will be ignored).
218+
* <p>
219+
* Defaults to <code>1/(dims + 1)</code> for <code>int8</code> quantized vectors
220+
* and <code>0</code> for <code>int4</code> for dynamic quantile calculation.
221+
* <p>
222+
* Only applicable to <code>int8_hnsw</code>, <code>int4_hnsw</code>,
223+
* <code>int8_flat</code>, and <code>int4_flat</code> index types.
224+
* <p>
225+
* API name: {@code confidence_interval}
181226
*/
182-
public final Builder type(String value) {
183-
this.type = value;
227+
public final Builder confidenceInterval(@Nullable Float value) {
228+
this.confidenceInterval = value;
184229
return this;
185230
}
186231

187232
/**
188-
* API name: {@code m}
233+
* The number of candidates to track while assembling the list of nearest
234+
* neighbors for each new node.
235+
* <p>
236+
* Only applicable to <code>hnsw</code>, <code>int8_hnsw</code>, and
237+
* <code>int4_hnsw</code> index types.
238+
* <p>
239+
* API name: {@code ef_construction}
189240
*/
190-
public final Builder m(@Nullable Integer value) {
191-
this.m = value;
241+
public final Builder efConstruction(@Nullable Integer value) {
242+
this.efConstruction = value;
192243
return this;
193244
}
194245

195246
/**
196-
* API name: {@code ef_construction}
247+
* The number of neighbors each node will be connected to in the HNSW graph.
248+
* <p>
249+
* Only applicable to <code>hnsw</code>, <code>int8_hnsw</code>, and
250+
* <code>int4_hnsw</code> index types.
251+
* <p>
252+
* API name: {@code m}
197253
*/
198-
public final Builder efConstruction(@Nullable Integer value) {
199-
this.efConstruction = value;
254+
public final Builder m(@Nullable Integer value) {
255+
this.m = value;
200256
return this;
201257
}
202258

203259
/**
204-
* API name: {@code confidence_interval}
260+
* Required - The type of kNN algorithm to use.
261+
* <p>
262+
* API name: {@code type}
205263
*/
206-
public final Builder confidenceInterval(@Nullable Float value) {
207-
this.confidenceInterval = value;
264+
public final Builder type(DenseVectorIndexOptionsType value) {
265+
this.type = value;
208266
return this;
209267
}
210268

@@ -237,10 +295,10 @@ public DenseVectorIndexOptions build() {
237295
protected static void setupDenseVectorIndexOptionsDeserializer(
238296
ObjectDeserializer<DenseVectorIndexOptions.Builder> op) {
239297

240-
op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type");
241-
op.add(Builder::m, JsonpDeserializer.integerDeserializer(), "m");
242-
op.add(Builder::efConstruction, JsonpDeserializer.integerDeserializer(), "ef_construction");
243298
op.add(Builder::confidenceInterval, JsonpDeserializer.floatDeserializer(), "confidence_interval");
299+
op.add(Builder::efConstruction, JsonpDeserializer.integerDeserializer(), "ef_construction");
300+
op.add(Builder::m, JsonpDeserializer.integerDeserializer(), "m");
301+
op.add(Builder::type, DenseVectorIndexOptionsType._DESERIALIZER, "type");
244302

245303
}
246304

0 commit comments

Comments
 (0)