Skip to content

Commit 7d3ecf5

Browse files
committed
[codegen-serverless] update to latest api spec
1 parent 1567252 commit 7d3ecf5

Some content is hidden

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

48 files changed

+4385
-839
lines changed

java-client-serverless/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-serverless/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-serverless/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-serverless/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-serverless/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

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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._types.aggregations;
21+
22+
import co.elastic.clients.json.JsonpDeserializable;
23+
import co.elastic.clients.json.JsonpDeserializer;
24+
import co.elastic.clients.json.ObjectBuilderDeserializer;
25+
import co.elastic.clients.json.ObjectDeserializer;
26+
import co.elastic.clients.util.ObjectBuilder;
27+
import jakarta.json.stream.JsonGenerator;
28+
import java.util.Objects;
29+
import java.util.function.Function;
30+
31+
//----------------------------------------------------------------
32+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
33+
//----------------------------------------------------------------
34+
//
35+
// This code is generated from the Elasticsearch API specification
36+
// at https://github.com/elastic/elasticsearch-specification
37+
//
38+
// Manual updates to this file will be lost when the code is
39+
// re-generated.
40+
//
41+
// If you find a property that is missing or wrongly typed, please
42+
// open an issue or a PR on the API specification repository.
43+
//
44+
//----------------------------------------------------------------
45+
46+
// typedef: _types.aggregations.TimeSeriesAggregate
47+
48+
/**
49+
*
50+
* @see <a href=
51+
* "../../doc-files/api-spec.html#_types.aggregations.TimeSeriesAggregate">API
52+
* specification</a>
53+
*/
54+
@JsonpDeserializable
55+
public class TimeSeriesAggregate extends MultiBucketAggregateBase<TimeSeriesBucket> implements AggregateVariant {
56+
// ---------------------------------------------------------------------------------------------
57+
58+
private TimeSeriesAggregate(Builder builder) {
59+
super(builder);
60+
61+
}
62+
63+
public static TimeSeriesAggregate of(Function<Builder, ObjectBuilder<TimeSeriesAggregate>> fn) {
64+
return fn.apply(new Builder()).build();
65+
}
66+
67+
/**
68+
* Aggregate variant kind.
69+
*/
70+
@Override
71+
public Aggregate.Kind _aggregateKind() {
72+
return Aggregate.Kind.TimeSeries;
73+
}
74+
75+
// ---------------------------------------------------------------------------------------------
76+
77+
/**
78+
* Builder for {@link TimeSeriesAggregate}.
79+
*/
80+
81+
public static class Builder extends MultiBucketAggregateBase.AbstractBuilder<TimeSeriesBucket, Builder>
82+
implements
83+
ObjectBuilder<TimeSeriesAggregate> {
84+
@Override
85+
protected Builder self() {
86+
return this;
87+
}
88+
89+
/**
90+
* Builds a {@link TimeSeriesAggregate}.
91+
*
92+
* @throws NullPointerException
93+
* if some of the required fields are null.
94+
*/
95+
public TimeSeriesAggregate build() {
96+
_checkSingleUse();
97+
super.tBucketSerializer(null);
98+
99+
return new TimeSeriesAggregate(this);
100+
}
101+
}
102+
103+
// ---------------------------------------------------------------------------------------------
104+
105+
/**
106+
* Json deserializer for {@link TimeSeriesAggregate}
107+
*/
108+
public static final JsonpDeserializer<TimeSeriesAggregate> _DESERIALIZER = ObjectBuilderDeserializer
109+
.lazy(Builder::new, TimeSeriesAggregate::setupTimeSeriesAggregateDeserializer);
110+
111+
protected static void setupTimeSeriesAggregateDeserializer(ObjectDeserializer<TimeSeriesAggregate.Builder> op) {
112+
MultiBucketAggregateBase.setupMultiBucketAggregateBaseDeserializer(op, TimeSeriesBucket._DESERIALIZER);
113+
114+
}
115+
116+
}

0 commit comments

Comments
 (0)