Skip to content

Commit be1f9aa

Browse files
committed
[codegen] update to latest spec
1 parent 0186134 commit be1f9aa

Some content is hidden

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

52 files changed

+5229
-870
lines changed

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

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import co.elastic.clients.util.WithJsonObjectBuilderBase;
3232
import jakarta.json.stream.JsonGenerator;
3333
import java.lang.String;
34-
import java.util.List;
3534
import java.util.Map;
3635
import java.util.Objects;
3736
import java.util.function.Function;
@@ -72,11 +71,6 @@ public class NodeAttributes implements JsonpSerializable {
7271

7372
private final String transportAddress;
7473

75-
private final List<NodeRole> roles;
76-
77-
@Nullable
78-
private final String externalId;
79-
8074
// ---------------------------------------------------------------------------------------------
8175

8276
private NodeAttributes(Builder builder) {
@@ -86,8 +80,6 @@ private NodeAttributes(Builder builder) {
8680
this.id = builder.id;
8781
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
8882
this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress");
89-
this.roles = ApiTypeHelper.unmodifiable(builder.roles);
90-
this.externalId = builder.externalId;
9183

9284
}
9385

@@ -141,21 +133,6 @@ public final String transportAddress() {
141133
return this.transportAddress;
142134
}
143135

144-
/**
145-
* API name: {@code roles}
146-
*/
147-
public final List<NodeRole> roles() {
148-
return this.roles;
149-
}
150-
151-
/**
152-
* API name: {@code external_id}
153-
*/
154-
@Nullable
155-
public final String externalId() {
156-
return this.externalId;
157-
}
158-
159136
/**
160137
* Serialize this object to JSON.
161138
*/
@@ -192,21 +169,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
192169
generator.writeKey("transport_address");
193170
generator.write(this.transportAddress);
194171

195-
if (ApiTypeHelper.isDefined(this.roles)) {
196-
generator.writeKey("roles");
197-
generator.writeStartArray();
198-
for (NodeRole item0 : this.roles) {
199-
item0.serialize(generator, mapper);
200-
}
201-
generator.writeEnd();
202-
203-
}
204-
if (this.externalId != null) {
205-
generator.writeKey("external_id");
206-
generator.write(this.externalId);
207-
208-
}
209-
210172
}
211173

212174
@Override
@@ -232,12 +194,6 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
232194

233195
private String transportAddress;
234196

235-
@Nullable
236-
private List<NodeRole> roles;
237-
238-
@Nullable
239-
private String externalId;
240-
241197
/**
242198
* Required - Lists node attributes.
243199
* <p>
@@ -302,34 +258,6 @@ public final Builder transportAddress(String value) {
302258
return this;
303259
}
304260

305-
/**
306-
* API name: {@code roles}
307-
* <p>
308-
* Adds all elements of <code>list</code> to <code>roles</code>.
309-
*/
310-
public final Builder roles(List<NodeRole> list) {
311-
this.roles = _listAddAll(this.roles, list);
312-
return this;
313-
}
314-
315-
/**
316-
* API name: {@code roles}
317-
* <p>
318-
* Adds one or more values to <code>roles</code>.
319-
*/
320-
public final Builder roles(NodeRole value, NodeRole... values) {
321-
this.roles = _listAdd(this.roles, value, values);
322-
return this;
323-
}
324-
325-
/**
326-
* API name: {@code external_id}
327-
*/
328-
public final Builder externalId(@Nullable String value) {
329-
this.externalId = value;
330-
return this;
331-
}
332-
333261
@Override
334262
protected Builder self() {
335263
return this;
@@ -364,8 +292,6 @@ protected static void setupNodeAttributesDeserializer(ObjectDeserializer<NodeAtt
364292
op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id");
365293
op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name");
366294
op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address");
367-
op.add(Builder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles");
368-
op.add(Builder::externalId, JsonpDeserializer.stringDeserializer(), "external_id");
369295

370296
}
371297

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ public enum Kind implements JsonEnum {
196196

197197
TTest("t_test"),
198198

199+
TimeSeries("time_series"),
200+
199201
TopHits("top_hits"),
200202

201203
TopMetrics("top_metrics"),
@@ -1307,6 +1309,23 @@ public TTestAggregate tTest() {
13071309
return TaggedUnionUtils.get(this, Kind.TTest);
13081310
}
13091311

1312+
/**
1313+
* Is this variant instance of kind {@code time_series}?
1314+
*/
1315+
public boolean isTimeSeries() {
1316+
return _kind == Kind.TimeSeries;
1317+
}
1318+
1319+
/**
1320+
* Get the {@code time_series} variant value.
1321+
*
1322+
* @throws IllegalStateException
1323+
* if the current variant is not of the {@code time_series} kind.
1324+
*/
1325+
public TimeSeriesAggregate timeSeries() {
1326+
return TaggedUnionUtils.get(this, Kind.TimeSeries);
1327+
}
1328+
13101329
/**
13111330
* Is this variant instance of kind {@code top_hits}?
13121331
*/
@@ -2156,6 +2175,17 @@ public ObjectBuilder<Aggregate> tTest(Function<TTestAggregate.Builder, ObjectBui
21562175
return this.tTest(fn.apply(new TTestAggregate.Builder()).build());
21572176
}
21582177

2178+
public ObjectBuilder<Aggregate> timeSeries(TimeSeriesAggregate v) {
2179+
this._kind = Kind.TimeSeries;
2180+
this._value = v;
2181+
return this;
2182+
}
2183+
2184+
public ObjectBuilder<Aggregate> timeSeries(
2185+
Function<TimeSeriesAggregate.Builder, ObjectBuilder<TimeSeriesAggregate>> fn) {
2186+
return this.timeSeries(fn.apply(new TimeSeriesAggregate.Builder()).build());
2187+
}
2188+
21592189
public ObjectBuilder<Aggregate> topHits(TopHitsAggregate v) {
21602190
this._kind = Kind.TopHits;
21612191
this._value = v;
@@ -2342,6 +2372,7 @@ public Aggregate build() {
23422372
deserializers.put("tdigest_percentile_ranks", TDigestPercentileRanksAggregate._DESERIALIZER);
23432373
deserializers.put("tdigest_percentiles", TDigestPercentilesAggregate._DESERIALIZER);
23442374
deserializers.put("t_test", TTestAggregate._DESERIALIZER);
2375+
deserializers.put("time_series", TimeSeriesAggregate._DESERIALIZER);
23452376
deserializers.put("top_hits", TopHitsAggregate._DESERIALIZER);
23462377
deserializers.put("top_metrics", TopMetricsAggregate._DESERIALIZER);
23472378
deserializers.put("umrareterms", UnmappedRareTermsAggregate._DESERIALIZER);

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,24 @@ public static Aggregate tTest(Function<TTestAggregate.Builder, ObjectBuilder<TTe
11491149
return builder.build();
11501150
}
11511151

1152+
/**
1153+
* Creates a builder for the {@link TimeSeriesAggregate time_series}
1154+
* {@code Aggregate} variant.
1155+
*/
1156+
public static TimeSeriesAggregate.Builder timeSeries() {
1157+
return new TimeSeriesAggregate.Builder();
1158+
}
1159+
1160+
/**
1161+
* Creates a Aggregate of the {@link TimeSeriesAggregate time_series}
1162+
* {@code Aggregate} variant.
1163+
*/
1164+
public static Aggregate timeSeries(Function<TimeSeriesAggregate.Builder, ObjectBuilder<TimeSeriesAggregate>> fn) {
1165+
Aggregate.Builder builder = new Aggregate.Builder();
1166+
builder.timeSeries(fn.apply(new TimeSeriesAggregate.Builder()).build());
1167+
return builder.build();
1168+
}
1169+
11521170
/**
11531171
* Creates a builder for the {@link TopHitsAggregate top_hits} {@code Aggregate}
11541172
* variant.

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ public enum Kind implements JsonEnum {
215215

216216
Terms("terms"),
217217

218+
TimeSeries("time_series"),
219+
218220
TopHits("top_hits"),
219221

220222
TTest("t_test"),
@@ -1493,6 +1495,23 @@ public TermsAggregation terms() {
14931495
return TaggedUnionUtils.get(this, Kind.Terms);
14941496
}
14951497

1498+
/**
1499+
* Is this variant instance of kind {@code time_series}?
1500+
*/
1501+
public boolean isTimeSeries() {
1502+
return _kind == Kind.TimeSeries;
1503+
}
1504+
1505+
/**
1506+
* Get the {@code time_series} variant value.
1507+
*
1508+
* @throws IllegalStateException
1509+
* if the current variant is not of the {@code time_series} kind.
1510+
*/
1511+
public TimeSeriesAggregation timeSeries() {
1512+
return TaggedUnionUtils.get(this, Kind.TimeSeries);
1513+
}
1514+
14961515
/**
14971516
* Is this variant instance of kind {@code top_hits}?
14981517
*/
@@ -2477,6 +2496,17 @@ public ContainerBuilder terms(Function<TermsAggregation.Builder, ObjectBuilder<T
24772496
return this.terms(fn.apply(new TermsAggregation.Builder()).build());
24782497
}
24792498

2499+
public ContainerBuilder timeSeries(TimeSeriesAggregation v) {
2500+
this._kind = Kind.TimeSeries;
2501+
this._value = v;
2502+
return new ContainerBuilder();
2503+
}
2504+
2505+
public ContainerBuilder timeSeries(
2506+
Function<TimeSeriesAggregation.Builder, ObjectBuilder<TimeSeriesAggregation>> fn) {
2507+
return this.timeSeries(fn.apply(new TimeSeriesAggregation.Builder()).build());
2508+
}
2509+
24802510
public ContainerBuilder topHits(TopHitsAggregation v) {
24812511
this._kind = Kind.TopHits;
24822512
this._value = v;
@@ -2702,6 +2732,7 @@ protected static void setupAggregationDeserializer(ObjectDeserializer<Builder> o
27022732
op.add(Builder::sum, SumAggregation._DESERIALIZER, "sum");
27032733
op.add(Builder::sumBucket, SumBucketAggregation._DESERIALIZER, "sum_bucket");
27042734
op.add(Builder::terms, TermsAggregation._DESERIALIZER, "terms");
2735+
op.add(Builder::timeSeries, TimeSeriesAggregation._DESERIALIZER, "time_series");
27052736
op.add(Builder::topHits, TopHitsAggregation._DESERIALIZER, "top_hits");
27062737
op.add(Builder::tTest, TTestAggregation._DESERIALIZER, "t_test");
27072738
op.add(Builder::topMetrics, TopMetricsAggregation._DESERIALIZER, "top_metrics");

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,25 @@ public static Aggregation terms(Function<TermsAggregation.Builder, ObjectBuilder
13351335
return builder.build();
13361336
}
13371337

1338+
/**
1339+
* Creates a builder for the {@link TimeSeriesAggregation time_series}
1340+
* {@code Aggregation} variant.
1341+
*/
1342+
public static TimeSeriesAggregation.Builder timeSeries() {
1343+
return new TimeSeriesAggregation.Builder();
1344+
}
1345+
1346+
/**
1347+
* Creates a Aggregation of the {@link TimeSeriesAggregation time_series}
1348+
* {@code Aggregation} variant.
1349+
*/
1350+
public static Aggregation timeSeries(
1351+
Function<TimeSeriesAggregation.Builder, ObjectBuilder<TimeSeriesAggregation>> fn) {
1352+
Aggregation.Builder builder = new Aggregation.Builder();
1353+
builder.timeSeries(fn.apply(new TimeSeriesAggregation.Builder()).build());
1354+
return builder.build();
1355+
}
1356+
13381357
/**
13391358
* Creates a builder for the {@link TopHitsAggregation top_hits}
13401359
* {@code Aggregation} variant.

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public static AggregationRange of(Function<Builder, ObjectBuilder<AggregationRan
8787
* Start of the range (inclusive).
8888
* <p>
8989
* API name: {@code from}
90+
* <p>
91+
* Defaults to {@code 0} if parsed from a JSON {@code null} value.
9092
*/
9193
@Nullable
9294
public final Double from() {
@@ -107,6 +109,8 @@ public final String key() {
107109
* End of the range (exclusive).
108110
* <p>
109111
* API name: {@code to}
112+
* <p>
113+
* Defaults to {@code 0} if parsed from a JSON {@code null} value.
110114
*/
111115
@Nullable
112116
public final Double to() {
@@ -126,8 +130,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
126130

127131
if (this.from != null) {
128132
generator.writeKey("from");
129-
generator.write(this.from);
130-
133+
JsonpUtils.serializeDoubleOrNull(generator, this.from, 0);
131134
}
132135
if (this.key != null) {
133136
generator.writeKey("key");
@@ -136,8 +139,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
136139
}
137140
if (this.to != null) {
138141
generator.writeKey("to");
139-
generator.write(this.to);
140-
142+
JsonpUtils.serializeDoubleOrNull(generator, this.to, 0);
141143
}
142144

143145
}
@@ -167,6 +169,8 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
167169
* Start of the range (inclusive).
168170
* <p>
169171
* API name: {@code from}
172+
* <p>
173+
* Defaults to {@code 0} if parsed from a JSON {@code null} value.
170174
*/
171175
public final Builder from(@Nullable Double value) {
172176
this.from = value;
@@ -187,6 +191,8 @@ public final Builder key(@Nullable String value) {
187191
* End of the range (exclusive).
188192
* <p>
189193
* API name: {@code to}
194+
* <p>
195+
* Defaults to {@code 0} if parsed from a JSON {@code null} value.
190196
*/
191197
public final Builder to(@Nullable Double value) {
192198
this.to = value;
@@ -221,9 +227,9 @@ public AggregationRange build() {
221227

222228
protected static void setupAggregationRangeDeserializer(ObjectDeserializer<AggregationRange.Builder> op) {
223229

224-
op.add(Builder::from, JsonpDeserializer.doubleDeserializer(), "from");
230+
op.add(Builder::from, JsonpDeserializer.doubleOrNullDeserializer(0), "from");
225231
op.add(Builder::key, JsonpDeserializer.stringDeserializer(), "key");
226-
op.add(Builder::to, JsonpDeserializer.doubleDeserializer(), "to");
232+
op.add(Builder::to, JsonpDeserializer.doubleOrNullDeserializer(0), "to");
227233

228234
}
229235

0 commit comments

Comments
 (0)