@@ -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 }
0 commit comments