Skip to content

Commit 8d88060

Browse files
[codegen] update to latest spec (#1281)
Co-authored-by: Laura Trotta <laura.trotta@elastic.co>
1 parent 438813c commit 8d88060

9 files changed

Lines changed: 1033 additions & 176 deletions

File tree

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public class RuntimeField implements DynamicTemplateVariant, JsonpSerializable {
8181
@Nullable
8282
private final Script script;
8383

84+
@Nullable
85+
private final OnScriptError onScriptError;
86+
8487
private final RuntimeFieldType type;
8588

8689
// ---------------------------------------------------------------------------------------------
@@ -94,6 +97,7 @@ private RuntimeField(Builder builder) {
9497
this.targetField = builder.targetField;
9598
this.targetIndex = builder.targetIndex;
9699
this.script = builder.script;
100+
this.onScriptError = builder.onScriptError;
97101
this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type");
98102

99103
}
@@ -178,6 +182,14 @@ public final Script script() {
178182
return this.script;
179183
}
180184

185+
/**
186+
* API name: {@code on_script_error}
187+
*/
188+
@Nullable
189+
public final OnScriptError onScriptError() {
190+
return this.onScriptError;
191+
}
192+
181193
/**
182194
* Required - Field type, which can be: <code>boolean</code>,
183195
* <code>composite</code>, <code>date</code>, <code>double</code>,
@@ -247,6 +259,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
247259
this.script.serialize(generator, mapper);
248260

249261
}
262+
if (this.onScriptError != null) {
263+
generator.writeKey("on_script_error");
264+
this.onScriptError.serialize(generator, mapper);
265+
}
250266
generator.writeKey("type");
251267
this.type.serialize(generator, mapper);
252268

@@ -285,6 +301,9 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
285301
@Nullable
286302
private Script script;
287303

304+
@Nullable
305+
private OnScriptError onScriptError;
306+
288307
private RuntimeFieldType type;
289308

290309
public Builder() {
@@ -297,6 +316,7 @@ private Builder(RuntimeField instance) {
297316
this.targetField = instance.targetField;
298317
this.targetIndex = instance.targetIndex;
299318
this.script = instance.script;
319+
this.onScriptError = instance.onScriptError;
300320
this.type = instance.type;
301321

302322
}
@@ -431,6 +451,14 @@ public final Builder script(Function<Script.Builder, ObjectBuilder<Script>> fn)
431451
return this.script(fn.apply(new Script.Builder()).build());
432452
}
433453

454+
/**
455+
* API name: {@code on_script_error}
456+
*/
457+
public final Builder onScriptError(@Nullable OnScriptError value) {
458+
this.onScriptError = value;
459+
return this;
460+
}
461+
434462
/**
435463
* Required - Field type, which can be: <code>boolean</code>,
436464
* <code>composite</code>, <code>date</code>, <code>double</code>,
@@ -486,6 +514,7 @@ protected static void setupRuntimeFieldDeserializer(ObjectDeserializer<RuntimeFi
486514
op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field");
487515
op.add(Builder::targetIndex, JsonpDeserializer.stringDeserializer(), "target_index");
488516
op.add(Builder::script, Script._DESERIALIZER, "script");
517+
op.add(Builder::onScriptError, OnScriptError._DESERIALIZER, "on_script_error");
489518
op.add(Builder::type, RuntimeFieldType._DESERIALIZER, "type");
490519

491520
}

java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html

Lines changed: 179 additions & 176 deletions
Large diffs are not rendered by default.

java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ public class IndexSettings implements JsonpSerializable {
167167
@Nullable
168168
private final IndexRouting routing;
169169

170+
@Nullable
171+
private final IndexSettingsUnassigned unassigned;
172+
170173
@Nullable
171174
private final Time gcDeletes;
172175

@@ -279,6 +282,7 @@ private IndexSettings(Builder builder) {
279282
this.maxTermsCount = builder.maxTermsCount;
280283
this.maxRegexLength = builder.maxRegexLength;
281284
this.routing = builder.routing;
285+
this.unassigned = builder.unassigned;
282286
this.gcDeletes = builder.gcDeletes;
283287
this.defaultPipeline = builder.defaultPipeline;
284288
this.finalPipeline = builder.finalPipeline;
@@ -572,6 +576,14 @@ public final IndexRouting routing() {
572576
return this.routing;
573577
}
574578

579+
/**
580+
* API name: {@code unassigned}
581+
*/
582+
@Nullable
583+
public final IndexSettingsUnassigned unassigned() {
584+
return this.unassigned;
585+
}
586+
575587
/**
576588
* API name: {@code gc_deletes}
577589
*/
@@ -962,6 +974,11 @@ else if (isExpNullAutoExpandReplicas) {
962974
generator.writeKey("routing");
963975
this.routing.serialize(generator, mapper);
964976

977+
}
978+
if (this.unassigned != null) {
979+
generator.writeKey("unassigned");
980+
this.unassigned.serialize(generator, mapper);
981+
965982
}
966983
if (this.gcDeletes != null) {
967984
generator.writeKey("gc_deletes");
@@ -1232,6 +1249,9 @@ public final Builder otherSettings(String key, JsonData value) {
12321249
@Nullable
12331250
private IndexRouting routing;
12341251

1252+
@Nullable
1253+
private IndexSettingsUnassigned unassigned;
1254+
12351255
@Nullable
12361256
private Time gcDeletes;
12371257

@@ -1341,6 +1361,7 @@ private Builder(IndexSettings instance) {
13411361
this.maxTermsCount = instance.maxTermsCount;
13421362
this.maxRegexLength = instance.maxRegexLength;
13431363
this.routing = instance.routing;
1364+
this.unassigned = instance.unassigned;
13441365
this.gcDeletes = instance.gcDeletes;
13451366
this.defaultPipeline = instance.defaultPipeline;
13461367
this.finalPipeline = instance.finalPipeline;
@@ -1717,6 +1738,22 @@ public final Builder routing(Function<IndexRouting.Builder, ObjectBuilder<IndexR
17171738
return this.routing(fn.apply(new IndexRouting.Builder()).build());
17181739
}
17191740

1741+
/**
1742+
* API name: {@code unassigned}
1743+
*/
1744+
public final Builder unassigned(@Nullable IndexSettingsUnassigned value) {
1745+
this.unassigned = value;
1746+
return this;
1747+
}
1748+
1749+
/**
1750+
* API name: {@code unassigned}
1751+
*/
1752+
public final Builder unassigned(
1753+
Function<IndexSettingsUnassigned.Builder, ObjectBuilder<IndexSettingsUnassigned>> fn) {
1754+
return this.unassigned(fn.apply(new IndexSettingsUnassigned.Builder()).build());
1755+
}
1756+
17201757
/**
17211758
* API name: {@code gc_deletes}
17221759
*/
@@ -2124,6 +2161,7 @@ protected static void setupIndexSettingsDeserializer(ObjectDeserializer<IndexSet
21242161
op.add(Builder::maxTermsCount, JsonpDeserializer.integerDeserializer(), "max_terms_count");
21252162
op.add(Builder::maxRegexLength, JsonpDeserializer.integerDeserializer(), "max_regex_length");
21262163
op.add(Builder::routing, IndexRouting._DESERIALIZER, "routing");
2164+
op.add(Builder::unassigned, IndexSettingsUnassigned._DESERIALIZER, "unassigned");
21272165
op.add(Builder::gcDeletes, Time._DESERIALIZER, "gc_deletes");
21282166
op.add(Builder::defaultPipeline, JsonpDeserializer.stringDeserializer(), "default_pipeline");
21292167
op.add(Builder::finalPipeline, JsonpDeserializer.stringDeserializer(), "final_pipeline");
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
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.indices;
21+
22+
import co.elastic.clients.json.JsonpDeserializable;
23+
import co.elastic.clients.json.JsonpDeserializer;
24+
import co.elastic.clients.json.JsonpMapper;
25+
import co.elastic.clients.json.JsonpSerializable;
26+
import co.elastic.clients.json.JsonpUtils;
27+
import co.elastic.clients.json.ObjectBuilderDeserializer;
28+
import co.elastic.clients.json.ObjectDeserializer;
29+
import co.elastic.clients.util.ObjectBuilder;
30+
import co.elastic.clients.util.WithJsonObjectBuilderBase;
31+
import jakarta.json.stream.JsonGenerator;
32+
import java.util.Objects;
33+
import java.util.function.Function;
34+
import javax.annotation.Nullable;
35+
36+
//----------------------------------------------------------------
37+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
38+
//----------------------------------------------------------------
39+
//
40+
// This code is generated from the Elasticsearch API specification
41+
// at https://github.com/elastic/elasticsearch-specification
42+
//
43+
// Manual updates to this file will be lost when the code is
44+
// re-generated.
45+
//
46+
// If you find a property that is missing or wrongly typed, please
47+
// open an issue or a PR on the API specification repository.
48+
//
49+
//----------------------------------------------------------------
50+
51+
// typedef: indices._types.IndexSettingsUnassigned
52+
53+
/**
54+
*
55+
* @see <a href=
56+
* "../doc-files/api-spec.html#indices._types.IndexSettingsUnassigned">API
57+
* specification</a>
58+
*/
59+
@JsonpDeserializable
60+
public class IndexSettingsUnassigned implements JsonpSerializable {
61+
@Nullable
62+
private final IndexSettingsUnassignedNodeLeft nodeLeft;
63+
64+
// ---------------------------------------------------------------------------------------------
65+
66+
private IndexSettingsUnassigned(Builder builder) {
67+
68+
this.nodeLeft = builder.nodeLeft;
69+
70+
}
71+
72+
public static IndexSettingsUnassigned of(Function<Builder, ObjectBuilder<IndexSettingsUnassigned>> fn) {
73+
return fn.apply(new Builder()).build();
74+
}
75+
76+
/**
77+
* API name: {@code node_left}
78+
*/
79+
@Nullable
80+
public final IndexSettingsUnassignedNodeLeft nodeLeft() {
81+
return this.nodeLeft;
82+
}
83+
84+
/**
85+
* Serialize this object to JSON.
86+
*/
87+
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
88+
generator.writeStartObject();
89+
serializeInternal(generator, mapper);
90+
generator.writeEnd();
91+
}
92+
93+
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
94+
95+
if (this.nodeLeft != null) {
96+
generator.writeKey("node_left");
97+
this.nodeLeft.serialize(generator, mapper);
98+
99+
}
100+
101+
}
102+
103+
@Override
104+
public String toString() {
105+
return JsonpUtils.toString(this);
106+
}
107+
108+
// ---------------------------------------------------------------------------------------------
109+
110+
/**
111+
* Builder for {@link IndexSettingsUnassigned}.
112+
*/
113+
114+
public static class Builder extends WithJsonObjectBuilderBase<Builder>
115+
implements
116+
ObjectBuilder<IndexSettingsUnassigned> {
117+
@Nullable
118+
private IndexSettingsUnassignedNodeLeft nodeLeft;
119+
120+
public Builder() {
121+
}
122+
private Builder(IndexSettingsUnassigned instance) {
123+
this.nodeLeft = instance.nodeLeft;
124+
125+
}
126+
/**
127+
* API name: {@code node_left}
128+
*/
129+
public final Builder nodeLeft(@Nullable IndexSettingsUnassignedNodeLeft value) {
130+
this.nodeLeft = value;
131+
return this;
132+
}
133+
134+
/**
135+
* API name: {@code node_left}
136+
*/
137+
public final Builder nodeLeft(
138+
Function<IndexSettingsUnassignedNodeLeft.Builder, ObjectBuilder<IndexSettingsUnassignedNodeLeft>> fn) {
139+
return this.nodeLeft(fn.apply(new IndexSettingsUnassignedNodeLeft.Builder()).build());
140+
}
141+
142+
@Override
143+
protected Builder self() {
144+
return this;
145+
}
146+
147+
/**
148+
* Builds a {@link IndexSettingsUnassigned}.
149+
*
150+
* @throws NullPointerException
151+
* if some of the required fields are null.
152+
*/
153+
public IndexSettingsUnassigned build() {
154+
_checkSingleUse();
155+
156+
return new IndexSettingsUnassigned(this);
157+
}
158+
}
159+
160+
/**
161+
* @return New {@link Builder} initialized with field values of this instance
162+
*/
163+
public Builder rebuild() {
164+
return new Builder(this);
165+
}
166+
// ---------------------------------------------------------------------------------------------
167+
168+
/**
169+
* Json deserializer for {@link IndexSettingsUnassigned}
170+
*/
171+
public static final JsonpDeserializer<IndexSettingsUnassigned> _DESERIALIZER = ObjectBuilderDeserializer
172+
.lazy(Builder::new, IndexSettingsUnassigned::setupIndexSettingsUnassignedDeserializer);
173+
174+
protected static void setupIndexSettingsUnassignedDeserializer(
175+
ObjectDeserializer<IndexSettingsUnassigned.Builder> op) {
176+
177+
op.add(Builder::nodeLeft, IndexSettingsUnassignedNodeLeft._DESERIALIZER, "node_left");
178+
179+
}
180+
181+
}

0 commit comments

Comments
 (0)