Skip to content

Commit f46b8b0

Browse files
committed
[codegen] update to latest spec
1 parent a3ee856 commit f46b8b0

File tree

7 files changed

+984
-164
lines changed

7 files changed

+984
-164
lines changed

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

+55-53
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@
14161416
'ilm.stop.Response': 'ilm/stop/StopIlmResponse.ts#L22-L24',
14171417
'indices._types.Alias': 'indices/_types/Alias.ts#L23-L53',
14181418
'indices._types.AliasDefinition': 'indices/_types/AliasDefinition.ts#L22-L54',
1419-
'indices._types.CacheQueries': 'indices/_types/IndexSettings.ts#L413-L415',
1419+
'indices._types.CacheQueries': 'indices/_types/IndexSettings.ts#L414-L416',
14201420
'indices._types.DataStream': 'indices/_types/DataStream.ts#L45-L127',
14211421
'indices._types.DataStreamIndex': 'indices/_types/DataStream.ts#L136-L157',
14221422
'indices._types.DataStreamLifecycle': 'indices/_types/DataStreamLifecycle.ts#L25-L31',
@@ -1429,7 +1429,7 @@
14291429
'indices._types.DownsamplingRound': 'indices/_types/DownsamplingRound.ts#L23-L32',
14301430
'indices._types.FailureStore': 'indices/_types/DataStream.ts#L39-L43',
14311431
'indices._types.FielddataFrequencyFilter': 'indices/_types/FielddataFrequencyFilter.ts#L22-L26',
1432-
'indices._types.IndexCheckOnStartup': 'indices/_types/IndexSettings.ts#L262-L269',
1432+
'indices._types.IndexCheckOnStartup': 'indices/_types/IndexSettings.ts#L263-L270',
14331433
'indices._types.IndexRouting': 'indices/_types/IndexRouting.ts#L22-L25',
14341434
'indices._types.IndexRoutingAllocation': 'indices/_types/IndexRouting.ts#L27-L32',
14351435
'indices._types.IndexRoutingAllocationDisk': 'indices/_types/IndexRouting.ts#L62-L64',
@@ -1439,64 +1439,64 @@
14391439
'indices._types.IndexRoutingRebalance': 'indices/_types/IndexRouting.ts#L34-L36',
14401440
'indices._types.IndexRoutingRebalanceOptions': 'indices/_types/IndexRouting.ts#L45-L50',
14411441
'indices._types.IndexSegmentSort': 'indices/_types/IndexSegmentSort.ts#L22-L27',
1442-
'indices._types.IndexSettingBlocks': 'indices/_types/IndexSettings.ts#L254-L260',
1442+
'indices._types.IndexSettingBlocks': 'indices/_types/IndexSettings.ts#L255-L261',
14431443
'indices._types.IndexSettings': 'indices/_types/IndexSettings.ts#L69-L169',
1444-
'indices._types.IndexSettingsAnalysis': 'indices/_types/IndexSettings.ts#L325-L331',
1445-
'indices._types.IndexSettingsLifecycle': 'indices/_types/IndexSettings.ts#L276-L315',
1446-
'indices._types.IndexSettingsLifecycleStep': 'indices/_types/IndexSettings.ts#L317-L323',
1447-
'indices._types.IndexSettingsTimeSeries': 'indices/_types/IndexSettings.ts#L333-L336',
1444+
'indices._types.IndexSettingsAnalysis': 'indices/_types/IndexSettings.ts#L326-L332',
1445+
'indices._types.IndexSettingsLifecycle': 'indices/_types/IndexSettings.ts#L277-L316',
1446+
'indices._types.IndexSettingsLifecycleStep': 'indices/_types/IndexSettings.ts#L318-L324',
1447+
'indices._types.IndexSettingsTimeSeries': 'indices/_types/IndexSettings.ts#L334-L337',
14481448
'indices._types.IndexState': 'indices/_types/IndexState.ts#L27-L40',
14491449
'indices._types.IndexTemplate': 'indices/_types/IndexTemplate.ts#L28-L81',
14501450
'indices._types.IndexTemplateDataStreamConfiguration': 'indices/_types/IndexTemplate.ts#L83-L94',
14511451
'indices._types.IndexTemplateSummary': 'indices/_types/IndexTemplate.ts#L96-L118',
1452-
'indices._types.IndexVersioning': 'indices/_types/IndexSettings.ts#L271-L274',
1453-
'indices._types.IndexingPressure': 'indices/_types/IndexSettings.ts#L567-L569',
1454-
'indices._types.IndexingPressureMemory': 'indices/_types/IndexSettings.ts#L571-L578',
1455-
'indices._types.IndexingSlowlogSettings': 'indices/_types/IndexSettings.ts#L580-L585',
1456-
'indices._types.IndexingSlowlogTresholds': 'indices/_types/IndexSettings.ts#L587-L594',
1452+
'indices._types.IndexVersioning': 'indices/_types/IndexSettings.ts#L272-L275',
1453+
'indices._types.IndexingPressure': 'indices/_types/IndexSettings.ts#L568-L570',
1454+
'indices._types.IndexingPressureMemory': 'indices/_types/IndexSettings.ts#L572-L579',
1455+
'indices._types.IndexingSlowlogSettings': 'indices/_types/IndexSettings.ts#L581-L586',
1456+
'indices._types.IndexingSlowlogTresholds': 'indices/_types/IndexSettings.ts#L588-L595',
14571457
'indices._types.ManagedBy': 'indices/_types/DataStream.ts#L32-L37',
1458-
'indices._types.MappingLimitSettings': 'indices/_types/IndexSettings.ts#L417-L431',
1459-
'indices._types.MappingLimitSettingsDepth': 'indices/_types/IndexSettings.ts#L452-L459',
1460-
'indices._types.MappingLimitSettingsDimensionFields': 'indices/_types/IndexSettings.ts#L489-L495',
1461-
'indices._types.MappingLimitSettingsFieldNameLength': 'indices/_types/IndexSettings.ts#L480-L487',
1462-
'indices._types.MappingLimitSettingsNestedFields': 'indices/_types/IndexSettings.ts#L461-L469',
1463-
'indices._types.MappingLimitSettingsNestedObjects': 'indices/_types/IndexSettings.ts#L471-L478',
1464-
'indices._types.MappingLimitSettingsSourceFields': 'indices/_types/IndexSettings.ts#L497-L499',
1465-
'indices._types.MappingLimitSettingsTotalFields': 'indices/_types/IndexSettings.ts#L433-L450',
1466-
'indices._types.Merge': 'indices/_types/IndexSettings.ts#L338-L340',
1467-
'indices._types.MergeScheduler': 'indices/_types/IndexSettings.ts#L342-L345',
1458+
'indices._types.MappingLimitSettings': 'indices/_types/IndexSettings.ts#L418-L432',
1459+
'indices._types.MappingLimitSettingsDepth': 'indices/_types/IndexSettings.ts#L453-L460',
1460+
'indices._types.MappingLimitSettingsDimensionFields': 'indices/_types/IndexSettings.ts#L490-L496',
1461+
'indices._types.MappingLimitSettingsFieldNameLength': 'indices/_types/IndexSettings.ts#L481-L488',
1462+
'indices._types.MappingLimitSettingsNestedFields': 'indices/_types/IndexSettings.ts#L462-L470',
1463+
'indices._types.MappingLimitSettingsNestedObjects': 'indices/_types/IndexSettings.ts#L472-L479',
1464+
'indices._types.MappingLimitSettingsSourceFields': 'indices/_types/IndexSettings.ts#L498-L500',
1465+
'indices._types.MappingLimitSettingsTotalFields': 'indices/_types/IndexSettings.ts#L434-L451',
1466+
'indices._types.Merge': 'indices/_types/IndexSettings.ts#L339-L341',
1467+
'indices._types.MergeScheduler': 'indices/_types/IndexSettings.ts#L343-L346',
14681468
'indices._types.NumericFielddata': 'indices/_types/NumericFielddata.ts#L22-L24',
14691469
'indices._types.NumericFielddataFormat': 'indices/_types/NumericFielddataFormat.ts#L20-L23',
1470-
'indices._types.Queries': 'indices/_types/IndexSettings.ts#L409-L411',
1470+
'indices._types.Queries': 'indices/_types/IndexSettings.ts#L410-L412',
14711471
'indices._types.RetentionLease': 'indices/_types/IndexSettings.ts#L65-L67',
1472-
'indices._types.SearchIdle': 'indices/_types/IndexSettings.ts#L245-L248',
1472+
'indices._types.SearchIdle': 'indices/_types/IndexSettings.ts#L246-L249',
14731473
'indices._types.SegmentSortMissing': 'indices/_types/IndexSegmentSort.ts#L43-L46',
14741474
'indices._types.SegmentSortMode': 'indices/_types/IndexSegmentSort.ts#L36-L41',
14751475
'indices._types.SegmentSortOrder': 'indices/_types/IndexSegmentSort.ts#L29-L34',
1476-
'indices._types.SettingsAnalyze': 'indices/_types/IndexSettings.ts#L235-L238',
1477-
'indices._types.SettingsHighlight': 'indices/_types/IndexSettings.ts#L230-L233',
1478-
'indices._types.SettingsQueryString': 'indices/_types/IndexSettings.ts#L250-L252',
1479-
'indices._types.SettingsSearch': 'indices/_types/IndexSettings.ts#L240-L243',
1480-
'indices._types.SettingsSimilarity': 'indices/_types/IndexSettings.ts#L171-L182',
1481-
'indices._types.SettingsSimilarityBm25': 'indices/_types/IndexSettings.ts#L188-L193',
1482-
'indices._types.SettingsSimilarityBoolean': 'indices/_types/IndexSettings.ts#L184-L186',
1483-
'indices._types.SettingsSimilarityDfi': 'indices/_types/IndexSettings.ts#L195-L198',
1484-
'indices._types.SettingsSimilarityDfr': 'indices/_types/IndexSettings.ts#L200-L205',
1485-
'indices._types.SettingsSimilarityIb': 'indices/_types/IndexSettings.ts#L207-L212',
1486-
'indices._types.SettingsSimilarityLmd': 'indices/_types/IndexSettings.ts#L214-L217',
1487-
'indices._types.SettingsSimilarityLmj': 'indices/_types/IndexSettings.ts#L219-L222',
1488-
'indices._types.SettingsSimilarityScripted': 'indices/_types/IndexSettings.ts#L224-L228',
1489-
'indices._types.SlowlogSettings': 'indices/_types/IndexSettings.ts#L507-L512',
1490-
'indices._types.SlowlogTresholdLevels': 'indices/_types/IndexSettings.ts#L519-L524',
1491-
'indices._types.SlowlogTresholds': 'indices/_types/IndexSettings.ts#L514-L517',
1476+
'indices._types.SettingsAnalyze': 'indices/_types/IndexSettings.ts#L236-L239',
1477+
'indices._types.SettingsHighlight': 'indices/_types/IndexSettings.ts#L231-L234',
1478+
'indices._types.SettingsQueryString': 'indices/_types/IndexSettings.ts#L251-L253',
1479+
'indices._types.SettingsSearch': 'indices/_types/IndexSettings.ts#L241-L244',
1480+
'indices._types.SettingsSimilarity': 'indices/_types/IndexSettings.ts#L171-L183',
1481+
'indices._types.SettingsSimilarityBm25': 'indices/_types/IndexSettings.ts#L189-L194',
1482+
'indices._types.SettingsSimilarityBoolean': 'indices/_types/IndexSettings.ts#L185-L187',
1483+
'indices._types.SettingsSimilarityDfi': 'indices/_types/IndexSettings.ts#L196-L199',
1484+
'indices._types.SettingsSimilarityDfr': 'indices/_types/IndexSettings.ts#L201-L206',
1485+
'indices._types.SettingsSimilarityIb': 'indices/_types/IndexSettings.ts#L208-L213',
1486+
'indices._types.SettingsSimilarityLmd': 'indices/_types/IndexSettings.ts#L215-L218',
1487+
'indices._types.SettingsSimilarityLmj': 'indices/_types/IndexSettings.ts#L220-L223',
1488+
'indices._types.SettingsSimilarityScripted': 'indices/_types/IndexSettings.ts#L225-L229',
1489+
'indices._types.SlowlogSettings': 'indices/_types/IndexSettings.ts#L508-L513',
1490+
'indices._types.SlowlogTresholdLevels': 'indices/_types/IndexSettings.ts#L520-L525',
1491+
'indices._types.SlowlogTresholds': 'indices/_types/IndexSettings.ts#L515-L518',
14921492
'indices._types.SoftDeletes': 'indices/_types/IndexSettings.ts#L50-L63',
1493-
'indices._types.SourceMode': 'indices/_types/IndexSettings.ts#L501-L505',
1494-
'indices._types.Storage': 'indices/_types/IndexSettings.ts#L526-L535',
1495-
'indices._types.StorageType': 'indices/_types/IndexSettings.ts#L537-L565',
1493+
'indices._types.SourceMode': 'indices/_types/IndexSettings.ts#L502-L506',
1494+
'indices._types.Storage': 'indices/_types/IndexSettings.ts#L527-L536',
1495+
'indices._types.StorageType': 'indices/_types/IndexSettings.ts#L538-L566',
14961496
'indices._types.TemplateMapping': 'indices/_types/TemplateMapping.ts#L27-L34',
1497-
'indices._types.Translog': 'indices/_types/IndexSettings.ts#L347-L369',
1498-
'indices._types.TranslogDurability': 'indices/_types/IndexSettings.ts#L371-L386',
1499-
'indices._types.TranslogRetention': 'indices/_types/IndexSettings.ts#L388-L407',
1497+
'indices._types.Translog': 'indices/_types/IndexSettings.ts#L348-L370',
1498+
'indices._types.TranslogDurability': 'indices/_types/IndexSettings.ts#L372-L387',
1499+
'indices._types.TranslogRetention': 'indices/_types/IndexSettings.ts#L389-L408',
15001500
'indices.add_block.IndicesBlockOptions': 'indices/add_block/IndicesAddBlockRequest.ts#L45-L50',
15011501
'indices.add_block.IndicesBlockStatus': 'indices/add_block/IndicesAddBlockResponse.ts#L30-L33',
15021502
'indices.add_block.Request': 'indices/add_block/IndicesAddBlockRequest.ts#L24-L43',
@@ -1856,8 +1856,8 @@
18561856
'ml._types.AnalysisLimits': 'ml/_types/Analysis.ts#L161-L172',
18571857
'ml._types.AnalysisMemoryLimit': 'ml/_types/Analysis.ts#L174-L179',
18581858
'ml._types.Anomaly': 'ml/_types/Anomaly.ts#L24-L121',
1859-
'ml._types.AnomalyCause': 'ml/_types/Anomaly.ts#L123-L138',
1860-
'ml._types.AnomalyExplanation': 'ml/_types/Anomaly.ts#L156-L197',
1859+
'ml._types.AnomalyCause': 'ml/_types/Anomaly.ts#L123-L139',
1860+
'ml._types.AnomalyExplanation': 'ml/_types/Anomaly.ts#L157-L198',
18611861
'ml._types.ApiKeyAuthorization': 'ml/_types/Authorization.ts#L20-L29',
18621862
'ml._types.AppliesTo': 'ml/_types/Rule.ts#L67-L72',
18631863
'ml._types.BucketInfluencer': 'ml/_types/Bucket.ts#L79-L127',
@@ -1934,14 +1934,14 @@
19341934
'ml._types.Filter': 'ml/_types/Filter.ts#L22-L29',
19351935
'ml._types.FilterRef': 'ml/_types/Filter.ts#L31-L41',
19361936
'ml._types.FilterType': 'ml/_types/Filter.ts#L43-L46',
1937-
'ml._types.GeoResults': 'ml/_types/Anomaly.ts#L145-L154',
1937+
'ml._types.GeoResults': 'ml/_types/Anomaly.ts#L146-L155',
19381938
'ml._types.Hyperparameter': 'ml/_types/TrainedModel.ts#L261-L275',
19391939
'ml._types.Hyperparameters': 'ml/_types/DataframeAnalytics.ts#L420-L526',
19401940
'ml._types.Include': 'ml/_types/Include.ts#L20-L47',
19411941
'ml._types.InferenceConfigCreateContainer': 'ml/_types/inference.ts#L23-L80',
19421942
'ml._types.InferenceConfigUpdateContainer': 'ml/_types/inference.ts#L284-L306',
19431943
'ml._types.InferenceResponseResult': 'ml/_types/inference.ts#L447-L495',
1944-
'ml._types.Influence': 'ml/_types/Anomaly.ts#L140-L143',
1944+
'ml._types.Influence': 'ml/_types/Anomaly.ts#L141-L144',
19451945
'ml._types.Influencer': 'ml/_types/Influencer.ts#L24-L76',
19461946
'ml._types.Job': 'ml/_types/Job.ts#L61-L180',
19471947
'ml._types.JobBlocked': 'ml/_types/Job.ts#L392-L395',
@@ -2642,8 +2642,10 @@
26422642
'shutdown.get_node.ShutdownType': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L40-L43',
26432643
'shutdown.put_node.Request': 'shutdown/put_node/ShutdownPutNodeRequest.ts#L25-L102',
26442644
'shutdown.put_node.Response': 'shutdown/put_node/ShutdownPutNodeResponse.ts#L22-L24',
2645+
'simulate.ingest.IngestDocumentSimulation': 'simulate/ingest/SimulateIngestResponse.ts#L35-L78',
26452646
'simulate.ingest.Request': 'simulate/ingest/SimulateIngestRequest.ts#L29-L90',
2646-
'simulate.ingest.Response': 'simulate/ingest/SimulateIngestResponse.ts#L22-L24',
2647+
'simulate.ingest.Response': 'simulate/ingest/SimulateIngestResponse.ts#L27-L29',
2648+
'simulate.ingest.SimulateIngestDocumentResult': 'simulate/ingest/SimulateIngestResponse.ts#L31-L33',
26472649
'slm._types.Configuration': 'slm/_types/SnapshotLifecycle.ts#L109-L139',
26482650
'slm._types.InProgress': 'slm/_types/SnapshotLifecycle.ts#L141-L146',
26492651
'slm._types.Invocation': 'slm/_types/SnapshotLifecycle.ts#L148-L151',
@@ -3038,10 +3040,10 @@
30383040
if (hash.length > 1) {
30393041
hash = hash.substring(1);
30403042
}
3041-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/38010a06f1aa679f9429f12a2c65cfeb9a4ac287/specification/" + (paths[hash] || "");
3043+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/84ad6dc6dc148b339efb98e35ec166a97774ea92/specification/" + (paths[hash] || "");
30423044
</script>
30433045
</head>
30443046
<body>
3045-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/38010a06f1aa679f9429f12a2c65cfeb9a4ac287/specification/">Elasticsearch API specification</a>.
3047+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/84ad6dc6dc148b339efb98e35ec166a97774ea92/specification/">Elasticsearch API specification</a>.
30463048
</body>
30473049
</html>

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

+73-8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package co.elastic.clients.elasticsearch.indices;
2121

22+
import co.elastic.clients.json.JsonData;
2223
import co.elastic.clients.json.JsonEnum;
2324
import co.elastic.clients.json.JsonpDeserializable;
2425
import co.elastic.clients.json.JsonpDeserializer;
@@ -29,10 +30,11 @@
2930
import co.elastic.clients.json.ObjectDeserializer;
3031
import co.elastic.clients.util.ApiTypeHelper;
3132
import co.elastic.clients.util.ObjectBuilder;
32-
import co.elastic.clients.util.TaggedUnion;
33+
import co.elastic.clients.util.OpenTaggedUnion;
3334
import co.elastic.clients.util.TaggedUnionUtils;
3435
import co.elastic.clients.util.WithJsonObjectBuilderBase;
3536
import jakarta.json.stream.JsonGenerator;
37+
import java.lang.Object;
3638
import java.util.Objects;
3739
import java.util.function.Function;
3840
import javax.annotation.Nullable;
@@ -61,10 +63,7 @@
6163
* specification</a>
6264
*/
6365
@JsonpDeserializable
64-
public class SettingsSimilarity
65-
implements
66-
TaggedUnion<SettingsSimilarity.Kind, SettingsSimilarityVariant>,
67-
JsonpSerializable {
66+
public class SettingsSimilarity implements OpenTaggedUnion<SettingsSimilarity.Kind, Object>, JsonpSerializable {
6867

6968
/**
7069
* {@link SettingsSimilarity} variant kinds.
@@ -91,6 +90,9 @@ public enum Kind implements JsonEnum {
9190

9291
Scripted("scripted"),
9392

93+
/** A custom {@code SettingsSimilarity} defined by a plugin */
94+
_Custom(null)
95+
9496
;
9597

9698
private final String jsonValue;
@@ -106,36 +108,48 @@ public String jsonValue() {
106108
}
107109

108110
private final Kind _kind;
109-
private final SettingsSimilarityVariant _value;
111+
private final Object _value;
110112

111113
@Override
112114
public final Kind _kind() {
113115
return _kind;
114116
}
115117

116118
@Override
117-
public final SettingsSimilarityVariant _get() {
119+
public final Object _get() {
118120
return _value;
119121
}
120122

121123
public SettingsSimilarity(SettingsSimilarityVariant value) {
122124

123125
this._kind = ApiTypeHelper.requireNonNull(value._settingsSimilarityKind(), this, "<variant kind>");
124126
this._value = ApiTypeHelper.requireNonNull(value, this, "<variant value>");
127+
this._customKind = null;
125128

126129
}
127130

128131
private SettingsSimilarity(Builder builder) {
129132

130133
this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, "<variant kind>");
131134
this._value = ApiTypeHelper.requireNonNull(builder._value, builder, "<variant value>");
135+
this._customKind = builder._customKind;
132136

133137
}
134138

135139
public static SettingsSimilarity of(Function<Builder, ObjectBuilder<SettingsSimilarity>> fn) {
136140
return fn.apply(new Builder()).build();
137141
}
138142

143+
/**
144+
* Build a custom plugin-defined {@code SettingsSimilarity}, given its kind and
145+
* some JSON data
146+
*/
147+
public SettingsSimilarity(String kind, JsonData value) {
148+
this._kind = Kind._Custom;
149+
this._value = value;
150+
this._customKind = kind;
151+
}
152+
139153
/**
140154
* Is this variant instance of kind {@code BM25}?
141155
*/
@@ -273,6 +287,35 @@ public SettingsSimilarityScripted scripted() {
273287
return TaggedUnionUtils.get(this, Kind.Scripted);
274288
}
275289

290+
@Nullable
291+
private final String _customKind;
292+
293+
/**
294+
* Is this a custom {@code SettingsSimilarity} defined by a plugin?
295+
*/
296+
public boolean _isCustom() {
297+
return _kind == Kind._Custom;
298+
}
299+
300+
/**
301+
* Get the actual kind when {@code _kind()} equals {@link Kind#_Custom}
302+
* (plugin-defined variant).
303+
*/
304+
@Nullable
305+
public final String _customKind() {
306+
return _customKind;
307+
}
308+
309+
/**
310+
* Get the custom plugin-defined variant value.
311+
*
312+
* @throws IllegalStateException
313+
* if the current variant is not {@link Kind#_Custom}.
314+
*/
315+
public JsonData _custom() {
316+
return TaggedUnionUtils.get(this, Kind._Custom);
317+
}
318+
276319
@Override
277320
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
278321

@@ -289,7 +332,8 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>
289332
implements
290333
ObjectBuilder<SettingsSimilarity> {
291334
private Kind _kind;
292-
private SettingsSimilarityVariant _value;
335+
private Object _value;
336+
private String _customKind;
293337

294338
@Override
295339
protected Builder self() {
@@ -383,6 +427,22 @@ public ObjectBuilder<SettingsSimilarity> scripted(
383427
return this.scripted(fn.apply(new SettingsSimilarityScripted.Builder()).build());
384428
}
385429

430+
/**
431+
* Define this {@code SettingsSimilarity} as a plugin-defined variant.
432+
*
433+
* @param name
434+
* the plugin-defined identifier
435+
* @param data
436+
* the data for this custom {@code SettingsSimilarity}. It is
437+
* converted internally to {@link JsonData}.
438+
*/
439+
public ObjectBuilder<SettingsSimilarity> _custom(String name, Object data) {
440+
this._kind = Kind._Custom;
441+
this._customKind = name;
442+
this._value = JsonData.of(data);
443+
return this;
444+
}
445+
386446
public SettingsSimilarity build() {
387447
_checkSingleUse();
388448
return new SettingsSimilarity(this);
@@ -401,6 +461,11 @@ protected static void setupSettingsSimilarityDeserializer(ObjectDeserializer<Bui
401461
op.add(Builder::lmjelinekmercer, SettingsSimilarityLmj._DESERIALIZER, "LMJelinekMercer");
402462
op.add(Builder::scripted, SettingsSimilarityScripted._DESERIALIZER, "scripted");
403463

464+
op.setUnknownFieldHandler((builder, name, parser, mapper) -> {
465+
JsonpUtils.ensureCustomVariantsAllowed(parser, mapper);
466+
builder._custom(name, JsonData._DESERIALIZER.deserialize(parser, mapper));
467+
});
468+
404469
op.setTypeProperty("type", null);
405470

406471
}

0 commit comments

Comments
 (0)