Skip to content

Commit 62f8f98

Browse files
committed
[codegen] update to latest spec
1 parent e1ff400 commit 62f8f98

Some content is hidden

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

48 files changed

+3413
-370
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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;
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="../doc-files/api-spec.html#_types.NodeStatsLevel">API
44+
* specification</a>
45+
*/
46+
@JsonpDeserializable
47+
public enum NodeStatsLevel implements JsonEnum {
48+
Node("node"),
49+
50+
Indices("indices"),
51+
52+
Shards("shards"),
53+
54+
;
55+
56+
private final String jsonValue;
57+
58+
NodeStatsLevel(String jsonValue) {
59+
this.jsonValue = jsonValue;
60+
}
61+
62+
public String jsonValue() {
63+
return this.jsonValue;
64+
}
65+
66+
public static final JsonEnum.Deserializer<NodeStatsLevel> _DESERIALIZER = new JsonEnum.Deserializer<>(
67+
NodeStatsLevel.values());
68+
}

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

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import co.elastic.clients.util.ObjectBuilder;
3131
import co.elastic.clients.util.WithJsonObjectBuilderBase;
3232
import jakarta.json.stream.JsonGenerator;
33+
import java.lang.Boolean;
3334
import java.lang.Integer;
3435
import java.lang.String;
3536
import java.util.Objects;
@@ -68,20 +69,25 @@ public class ShardFailure implements JsonpSerializable {
6869

6970
private final ErrorCause reason;
7071

71-
private final int shard;
72+
@Nullable
73+
private final Integer shard;
7274

7375
@Nullable
7476
private final String status;
7577

78+
@Nullable
79+
private final Boolean primary;
80+
7681
// ---------------------------------------------------------------------------------------------
7782

7883
private ShardFailure(Builder builder) {
7984

8085
this.index = builder.index;
8186
this.node = builder.node;
8287
this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason");
83-
this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard", 0);
88+
this.shard = builder.shard;
8489
this.status = builder.status;
90+
this.primary = builder.primary;
8591

8692
}
8793

@@ -113,9 +119,10 @@ public final ErrorCause reason() {
113119
}
114120

115121
/**
116-
* Required - API name: {@code shard}
122+
* API name: {@code shard}
117123
*/
118-
public final int shard() {
124+
@Nullable
125+
public final Integer shard() {
119126
return this.shard;
120127
}
121128

@@ -127,6 +134,14 @@ public final String status() {
127134
return this.status;
128135
}
129136

137+
/**
138+
* API name: {@code primary}
139+
*/
140+
@Nullable
141+
public final Boolean primary() {
142+
return this.primary;
143+
}
144+
130145
/**
131146
* Serialize this object to JSON.
132147
*/
@@ -151,14 +166,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
151166
generator.writeKey("reason");
152167
this.reason.serialize(generator, mapper);
153168

154-
generator.writeKey("shard");
155-
generator.write(this.shard);
169+
if (this.shard != null) {
170+
generator.writeKey("shard");
171+
generator.write(this.shard);
156172

173+
}
157174
if (this.status != null) {
158175
generator.writeKey("status");
159176
generator.write(this.status);
160177

161178
}
179+
if (this.primary != null) {
180+
generator.writeKey("primary");
181+
generator.write(this.primary);
182+
183+
}
162184

163185
}
164186

@@ -182,11 +204,15 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
182204

183205
private ErrorCause reason;
184206

207+
@Nullable
185208
private Integer shard;
186209

187210
@Nullable
188211
private String status;
189212

213+
@Nullable
214+
private Boolean primary;
215+
190216
/**
191217
* API name: {@code index}
192218
*/
@@ -219,9 +245,9 @@ public final Builder reason(Function<ErrorCause.Builder, ObjectBuilder<ErrorCaus
219245
}
220246

221247
/**
222-
* Required - API name: {@code shard}
248+
* API name: {@code shard}
223249
*/
224-
public final Builder shard(int value) {
250+
public final Builder shard(@Nullable Integer value) {
225251
this.shard = value;
226252
return this;
227253
}
@@ -234,6 +260,14 @@ public final Builder status(@Nullable String value) {
234260
return this;
235261
}
236262

263+
/**
264+
* API name: {@code primary}
265+
*/
266+
public final Builder primary(@Nullable Boolean value) {
267+
this.primary = value;
268+
return this;
269+
}
270+
237271
@Override
238272
protected Builder self() {
239273
return this;
@@ -262,11 +296,12 @@ public ShardFailure build() {
262296

263297
protected static void setupShardFailureDeserializer(ObjectDeserializer<ShardFailure.Builder> op) {
264298

265-
op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index");
266-
op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node");
299+
op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index", "_index");
300+
op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node", "_node");
267301
op.add(Builder::reason, ErrorCause._DESERIALIZER, "reason");
268-
op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard");
302+
op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard", "_shard");
269303
op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status");
304+
op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary");
270305

271306
}
272307

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

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
public class ChunkingSettings implements JsonpSerializable {
6565
private final String strategy;
6666

67+
@Nullable
6768
private final String separatorGroup;
6869

6970
private final List<String> separators;
@@ -81,8 +82,8 @@ public class ChunkingSettings implements JsonpSerializable {
8182
private ChunkingSettings(Builder builder) {
8283

8384
this.strategy = ApiTypeHelper.requireNonNull(builder.strategy, this, "strategy");
84-
this.separatorGroup = ApiTypeHelper.requireNonNull(builder.separatorGroup, this, "separatorGroup");
85-
this.separators = ApiTypeHelper.unmodifiableRequired(builder.separators, this, "separators");
85+
this.separatorGroup = builder.separatorGroup;
86+
this.separators = ApiTypeHelper.unmodifiable(builder.separators);
8687
this.maxChunkSize = ApiTypeHelper.requireNonNull(builder.maxChunkSize, this, "maxChunkSize", 0);
8788
this.overlap = builder.overlap;
8889
this.sentenceOverlap = builder.sentenceOverlap;
@@ -114,8 +115,8 @@ public final String strategy() {
114115
}
115116

116117
/**
117-
* Required - This parameter is only applicable when using the
118-
* <code>recursive</code> chunking strategy.
118+
* Only applicable to the <code>recursive</code> strategy and required when
119+
* using it.
119120
* <p>
120121
* Sets a predefined list of separators in the saved chunking settings based on
121122
* the selected text type. Values can be <code>markdown</code> or
@@ -126,13 +127,16 @@ public final String strategy() {
126127
* <p>
127128
* API name: {@code separator_group}
128129
*/
130+
@Nullable
129131
public final String separatorGroup() {
130132
return this.separatorGroup;
131133
}
132134

133135
/**
134-
* Required - A list of strings used as possible split points when chunking text
135-
* with the <code>recursive</code> strategy.
136+
* Only applicable to the <code>recursive</code> strategy and required when
137+
* using it.
138+
* <p>
139+
* A list of strings used as possible split points when chunking text.
136140
* <p>
137141
* Each string can be a plain string or a regular expression (regex) pattern.
138142
* The system tries each separator in order to split the text, starting from the
@@ -149,10 +153,10 @@ public final List<String> separators() {
149153
}
150154

151155
/**
152-
* Required - The maximum size of a chunk in words. This value cannot be higher
153-
* than <code>300</code> or lower than <code>20</code> (for
154-
* <code>sentence</code> strategy) or <code>10</code> (for <code>word</code>
155-
* strategy).
156+
* Required - The maximum size of a chunk in words. This value cannot be lower
157+
* than <code>20</code> (for <code>sentence</code> strategy) or <code>10</code>
158+
* (for <code>word</code> strategy). This value should not exceed the window
159+
* size for the associated model.
156160
* <p>
157161
* API name: {@code max_chunk_size}
158162
*/
@@ -198,9 +202,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
198202
generator.writeKey("strategy");
199203
generator.write(this.strategy);
200204

201-
generator.writeKey("separator_group");
202-
generator.write(this.separatorGroup);
205+
if (this.separatorGroup != null) {
206+
generator.writeKey("separator_group");
207+
generator.write(this.separatorGroup);
203208

209+
}
204210
if (ApiTypeHelper.isDefined(this.separators)) {
205211
generator.writeKey("separators");
206212
generator.writeStartArray();
@@ -241,8 +247,10 @@ public String toString() {
241247
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<ChunkingSettings> {
242248
private String strategy;
243249

250+
@Nullable
244251
private String separatorGroup;
245252

253+
@Nullable
246254
private List<String> separators;
247255

248256
private Integer maxChunkSize;
@@ -275,8 +283,8 @@ public final Builder strategy(String value) {
275283
}
276284

277285
/**
278-
* Required - This parameter is only applicable when using the
279-
* <code>recursive</code> chunking strategy.
286+
* Only applicable to the <code>recursive</code> strategy and required when
287+
* using it.
280288
* <p>
281289
* Sets a predefined list of separators in the saved chunking settings based on
282290
* the selected text type. Values can be <code>markdown</code> or
@@ -287,14 +295,16 @@ public final Builder strategy(String value) {
287295
* <p>
288296
* API name: {@code separator_group}
289297
*/
290-
public final Builder separatorGroup(String value) {
298+
public final Builder separatorGroup(@Nullable String value) {
291299
this.separatorGroup = value;
292300
return this;
293301
}
294302

295303
/**
296-
* Required - A list of strings used as possible split points when chunking text
297-
* with the <code>recursive</code> strategy.
304+
* Only applicable to the <code>recursive</code> strategy and required when
305+
* using it.
306+
* <p>
307+
* A list of strings used as possible split points when chunking text.
298308
* <p>
299309
* Each string can be a plain string or a regular expression (regex) pattern.
300310
* The system tries each separator in order to split the text, starting from the
@@ -314,8 +324,10 @@ public final Builder separators(List<String> list) {
314324
}
315325

316326
/**
317-
* Required - A list of strings used as possible split points when chunking text
318-
* with the <code>recursive</code> strategy.
327+
* Only applicable to the <code>recursive</code> strategy and required when
328+
* using it.
329+
* <p>
330+
* A list of strings used as possible split points when chunking text.
319331
* <p>
320332
* Each string can be a plain string or a regular expression (regex) pattern.
321333
* The system tries each separator in order to split the text, starting from the
@@ -335,10 +347,10 @@ public final Builder separators(String value, String... values) {
335347
}
336348

337349
/**
338-
* Required - The maximum size of a chunk in words. This value cannot be higher
339-
* than <code>300</code> or lower than <code>20</code> (for
340-
* <code>sentence</code> strategy) or <code>10</code> (for <code>word</code>
341-
* strategy).
350+
* Required - The maximum size of a chunk in words. This value cannot be lower
351+
* than <code>20</code> (for <code>sentence</code> strategy) or <code>10</code>
352+
* (for <code>word</code> strategy). This value should not exceed the window
353+
* size for the associated model.
342354
* <p>
343355
* API name: {@code max_chunk_size}
344356
*/

0 commit comments

Comments
 (0)