Skip to content

Commit e271995

Browse files
committed
[codegen] update to latest spec
1 parent c68b3ad commit e271995

13 files changed

Lines changed: 1062 additions & 185 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/core/bulk/BulkOperation.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@
5757
// typedef: _global.bulk.OperationContainer
5858

5959
/**
60-
*
60+
* An action line, which is the first line of each operation in a bulk request.
61+
* It specifies the action to perform (<code>index</code>, <code>create</code>,
62+
* <code>update</code>, or <code>delete</code>) and its metadata, such as the
63+
* target index and document ID. All actions except <code>delete</code> expect a
64+
* source line to follow.
65+
*
6166
* @see <a href=
6267
* "../../doc-files/api-spec.html#_global.bulk.OperationContainer">API
6368
* specification</a>

java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateAction.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@
5757
// typedef: _global.bulk.UpdateAction
5858

5959
/**
60-
*
60+
* The source line that must follow an <code>update</code> action line. It
61+
* specifies the partial document, script, or upsert options to apply, plus
62+
* optional update settings.
63+
*
6164
* @see <a href="../../doc-files/api-spec.html#_global.bulk.UpdateAction">API
6265
* specification</a>
6366
*/

java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SourceConfig.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -186,23 +186,23 @@ public SourceConfig build() {
186186
public static final JsonpDeserializer<SourceConfig> _DESERIALIZER = JsonpDeserializer
187187
.lazy(() -> JsonpDeserializer.of(EnumSet.of(JsonParser.Event.START_OBJECT, JsonParser.Event.START_ARRAY,
188188
JsonParser.Event.VALUE_TRUE, JsonParser.Event.VALUE_FALSE), (parser, mapper, event) -> {
189-
switch (event) {
190-
case VALUE_TRUE :
191-
return SourceConfig.of(b -> b.fetch(true));
192-
case VALUE_FALSE :
193-
return SourceConfig.of(b -> b.fetch(false));
194-
case START_ARRAY : {
195-
List<String> includes = JsonpDeserializer
196-
.arrayDeserializer(JsonpDeserializer.stringDeserializer())
197-
.deserialize(parser, mapper, event);
198-
return SourceConfig.of(b -> b.filter(f -> f.includes(includes)));
199-
}
200-
case START_OBJECT : {
201-
SourceFilter filter = SourceFilter._DESERIALIZER.deserialize(parser, mapper, event);
202-
return SourceConfig.of(b -> b.filter(filter));
203-
}
204-
default :
205-
return null;
206-
}
207-
}));
189+
switch (event) {
190+
case VALUE_TRUE :
191+
return SourceConfig.of(b -> b.fetch(true));
192+
case VALUE_FALSE :
193+
return SourceConfig.of(b -> b.fetch(false));
194+
case START_ARRAY : {
195+
List<String> includes = JsonpDeserializer
196+
.arrayDeserializer(JsonpDeserializer.stringDeserializer())
197+
.deserialize(parser, mapper, event);
198+
return SourceConfig.of(b -> b.filter(f -> f.includes(includes)));
199+
}
200+
case START_OBJECT : {
201+
SourceFilter filter = SourceFilter._DESERIALIZER.deserialize(parser, mapper, event);
202+
return SourceConfig.of(b -> b.filter(filter));
203+
}
204+
default :
205+
return null;
206+
}
207+
}));
208208
}

0 commit comments

Comments
 (0)