Skip to content

Commit 22bd743

Browse files
committed
[codegen] update to latest spec and generator
1 parent a535281 commit 22bd743

23 files changed

+335
-20
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
*/
6262
@JsonpDeserializable
6363
public class ArrayPercentilesItem implements JsonpSerializable {
64-
private final String key;
64+
private final double key;
6565

6666
private final double value;
6767

@@ -72,7 +72,7 @@ public class ArrayPercentilesItem implements JsonpSerializable {
7272

7373
private ArrayPercentilesItem(Builder builder) {
7474

75-
this.key = ApiTypeHelper.requireNonNull(builder.key, this, "key");
75+
this.key = ApiTypeHelper.requireNonNull(builder.key, this, "key", 0);
7676
this.value = ApiTypeHelper.requireNonNull(builder.value, this, "value", 0);
7777
this.valueAsString = builder.valueAsString;
7878

@@ -85,7 +85,7 @@ public static ArrayPercentilesItem of(Function<Builder, ObjectBuilder<ArrayPerce
8585
/**
8686
* Required - API name: {@code key}
8787
*/
88-
public final String key() {
88+
public final double key() {
8989
return this.key;
9090
}
9191

@@ -144,7 +144,7 @@ public String toString() {
144144
public static class Builder extends WithJsonObjectBuilderBase<Builder>
145145
implements
146146
ObjectBuilder<ArrayPercentilesItem> {
147-
private String key;
147+
private Double key;
148148

149149
private Double value;
150150

@@ -154,7 +154,7 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>
154154
/**
155155
* Required - API name: {@code key}
156156
*/
157-
public final Builder key(String value) {
157+
public final Builder key(double value) {
158158
this.key = value;
159159
return this;
160160
}
@@ -205,7 +205,7 @@ public ArrayPercentilesItem build() {
205205

206206
protected static void setupArrayPercentilesItemDeserializer(ObjectDeserializer<ArrayPercentilesItem.Builder> op) {
207207

208-
op.add(Builder::key, JsonpDeserializer.stringDeserializer(), "key");
208+
op.add(Builder::key, JsonpDeserializer.doubleDeserializer(), "key");
209209
op.add(Builder::value, JsonpDeserializer.doubleOrNullDeserializer(0), "value");
210210
op.add(Builder::valueAsString, JsonpDeserializer.stringDeserializer(), "value_as_string");
211211

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import java.util.Map;
3939
import java.util.Objects;
4040
import java.util.function.Function;
41+
import java.util.stream.Collectors;
4142
import javax.annotation.Nullable;
4243

4344
//----------------------------------------------------------------
@@ -92,6 +93,21 @@ private BucketsPath(Kind kind, Object value) {
9293
this._value = value;
9394
}
9495

96+
public String _toJsonString() {
97+
switch (_kind) {
98+
case Array :
99+
return this.array().stream().map(v -> v).collect(Collectors.joining(","));
100+
case Dict :
101+
return this.dict().entrySet().stream().map(e -> e.getKey() + ":" + e.getValue())
102+
.collect(Collectors.joining(","));
103+
case Single :
104+
return this.single();
105+
106+
default :
107+
throw new IllegalStateException("Unknown kind " + _kind);
108+
}
109+
}
110+
95111
private BucketsPath(Builder builder) {
96112

97113
this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, "<variant kind>");

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/NodesRequest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import jakarta.json.stream.JsonGenerator;
3535
import java.lang.Boolean;
3636
import java.lang.String;
37+
import java.util.Arrays;
3738
import java.util.Collections;
3839
import java.util.HashMap;
3940
import java.util.List;
@@ -258,6 +259,20 @@ public final Builder h(String value, String... values) {
258259
return this;
259260
}
260261

262+
/**
263+
* A comma-separated list of columns names to display. It supports simple
264+
* wildcards.
265+
* <p>
266+
* API name: {@code h}
267+
* <p>
268+
* Adds one or more enum values to <code>h</code>.
269+
*/
270+
public final Builder h(CatNodeColumn value, CatNodeColumn... values) {
271+
this.h = _listAdd(this.h, value.jsonValue(),
272+
Arrays.stream(values).map(CatNodeColumn::jsonValue).toArray(String[]::new));
273+
return this;
274+
}
275+
261276
/**
262277
* If true, the response includes information from segments that are not loaded
263278
* into memory.

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/RecoveryRequest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import jakarta.json.stream.JsonGenerator;
3434
import java.lang.Boolean;
3535
import java.lang.String;
36+
import java.util.Arrays;
3637
import java.util.HashMap;
3738
import java.util.List;
3839
import java.util.Map;
@@ -271,6 +272,20 @@ public final Builder h(String value, String... values) {
271272
return this;
272273
}
273274

275+
/**
276+
* A comma-separated list of columns names to display. It supports simple
277+
* wildcards.
278+
* <p>
279+
* API name: {@code h}
280+
* <p>
281+
* Adds one or more enum values to <code>h</code>.
282+
*/
283+
public final Builder h(CatRecoveryColumn value, CatRecoveryColumn... values) {
284+
this.h = _listAdd(this.h, value.jsonValue(),
285+
Arrays.stream(values).map(CatRecoveryColumn::jsonValue).toArray(String[]::new));
286+
return this;
287+
}
288+
274289
/**
275290
* A comma-separated list of data streams, indices, and aliases used to limit
276291
* the request. Supports wildcards (<code>*</code>). To target all data streams

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/SegmentsRequest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import jakarta.json.stream.JsonGenerator;
3434
import java.lang.Boolean;
3535
import java.lang.String;
36+
import java.util.Arrays;
3637
import java.util.HashMap;
3738
import java.util.List;
3839
import java.util.Map;
@@ -233,6 +234,20 @@ public final Builder h(String value, String... values) {
233234
return this;
234235
}
235236

237+
/**
238+
* A comma-separated list of columns names to display. It supports simple
239+
* wildcards.
240+
* <p>
241+
* API name: {@code h}
242+
* <p>
243+
* Adds one or more enum values to <code>h</code>.
244+
*/
245+
public final Builder h(CatSegmentsColumn value, CatSegmentsColumn... values) {
246+
this.h = _listAdd(this.h, value.jsonValue(),
247+
Arrays.stream(values).map(CatSegmentsColumn::jsonValue).toArray(String[]::new));
248+
return this;
249+
}
250+
236251
/**
237252
* A comma-separated list of data streams, indices, and aliases used to limit
238253
* the request. Supports wildcards (<code>*</code>). To target all data streams

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ShardsRequest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import co.elastic.clients.util.ObjectBuilder;
3434
import jakarta.json.stream.JsonGenerator;
3535
import java.lang.String;
36+
import java.util.Arrays;
3637
import java.util.HashMap;
3738
import java.util.List;
3839
import java.util.Map;
@@ -225,6 +226,19 @@ public final Builder h(String value, String... values) {
225226
return this;
226227
}
227228

229+
/**
230+
* List of columns to appear in the response. Supports simple wildcards.
231+
* <p>
232+
* API name: {@code h}
233+
* <p>
234+
* Adds one or more enum values to <code>h</code>.
235+
*/
236+
public final Builder h(CatShardColumn value, CatShardColumn... values) {
237+
this.h = _listAdd(this.h, value.jsonValue(),
238+
Arrays.stream(values).map(CatShardColumn::jsonValue).toArray(String[]::new));
239+
return this;
240+
}
241+
228242
/**
229243
* A comma-separated list of data streams, indices, and aliases used to limit
230244
* the request. Supports wildcards (<code>*</code>). To target all data streams

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/SnapshotsRequest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import jakarta.json.stream.JsonGenerator;
3434
import java.lang.Boolean;
3535
import java.lang.String;
36+
import java.util.Arrays;
3637
import java.util.HashMap;
3738
import java.util.List;
3839
import java.util.Map;
@@ -220,6 +221,20 @@ public final Builder h(String value, String... values) {
220221
return this;
221222
}
222223

224+
/**
225+
* A comma-separated list of columns names to display. It supports simple
226+
* wildcards.
227+
* <p>
228+
* API name: {@code h}
229+
* <p>
230+
* Adds one or more enum values to <code>h</code>.
231+
*/
232+
public final Builder h(CatSnapshotsColumn value, CatSnapshotsColumn... values) {
233+
this.h = _listAdd(this.h, value.jsonValue(),
234+
Arrays.stream(values).map(CatSnapshotsColumn::jsonValue).toArray(String[]::new));
235+
return this;
236+
}
237+
223238
/**
224239
* If <code>true</code>, the response does not include information from
225240
* unavailable snapshots.

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ThreadPoolRequest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import jakarta.json.stream.JsonGenerator;
3434
import java.lang.Boolean;
3535
import java.lang.String;
36+
import java.util.Arrays;
3637
import java.util.HashMap;
3738
import java.util.List;
3839
import java.util.Map;
@@ -219,6 +220,19 @@ public final Builder h(String value, String... values) {
219220
return this;
220221
}
221222

223+
/**
224+
* List of columns to appear in the response. Supports simple wildcards.
225+
* <p>
226+
* API name: {@code h}
227+
* <p>
228+
* Adds one or more enum values to <code>h</code>.
229+
*/
230+
public final Builder h(CatThreadPoolColumn value, CatThreadPoolColumn... values) {
231+
this.h = _listAdd(this.h, value.jsonValue(),
232+
Arrays.stream(values).map(CatThreadPoolColumn::jsonValue).toArray(String[]::new));
233+
return this;
234+
}
235+
222236
/**
223237
* If <code>true</code>, the request computes the list of selected nodes from
224238
* the local cluster state. If <code>false</code> the list of selected nodes are

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

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import co.elastic.clients.elasticsearch._types.SearchType;
2727
import co.elastic.clients.elasticsearch._types.SlicedScroll;
2828
import co.elastic.clients.elasticsearch._types.Slices;
29+
import co.elastic.clients.elasticsearch._types.SortOptions;
2930
import co.elastic.clients.elasticsearch._types.Time;
3031
import co.elastic.clients.elasticsearch._types.WaitForActiveShards;
3132
import co.elastic.clients.elasticsearch._types.query_dsl.Operator;
@@ -281,7 +282,7 @@ public class DeleteByQueryRequest extends RequestBase implements JsonpSerializab
281282
@Nullable
282283
private final Slices slices;
283284

284-
private final List<String> sort;
285+
private final List<SortOptions> sort;
285286

286287
private final List<String> stats;
287288

@@ -621,11 +622,11 @@ public final Slices slices() {
621622
}
622623

623624
/**
624-
* A comma-separated list of <code>&lt;field&gt;:&lt;direction&gt;</code> pairs.
625+
* A sort object that specifies the order of deleted documents.
625626
* <p>
626627
* API name: {@code sort}
627628
*/
628-
public final List<String> sort() {
629+
public final List<SortOptions> sort() {
629630
return this.sort;
630631
}
631632

@@ -731,6 +732,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
731732
this.slice.serialize(generator, mapper);
732733

733734
}
735+
if (ApiTypeHelper.isDefined(this.sort)) {
736+
generator.writeKey("sort");
737+
generator.writeStartArray();
738+
for (SortOptions item0 : this.sort) {
739+
item0.serialize(generator, mapper);
740+
741+
}
742+
generator.writeEnd();
743+
744+
}
734745

735746
}
736747

@@ -818,7 +829,7 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder>
818829
private Slices slices;
819830

820831
@Nullable
821-
private List<String> sort;
832+
private List<SortOptions> sort;
822833

823834
@Nullable
824835
private List<String> stats;
@@ -1207,29 +1218,40 @@ public final Builder slices(Function<Slices.Builder, ObjectBuilder<Slices>> fn)
12071218
}
12081219

12091220
/**
1210-
* A comma-separated list of <code>&lt;field&gt;:&lt;direction&gt;</code> pairs.
1221+
* A sort object that specifies the order of deleted documents.
12111222
* <p>
12121223
* API name: {@code sort}
12131224
* <p>
12141225
* Adds all elements of <code>list</code> to <code>sort</code>.
12151226
*/
1216-
public final Builder sort(List<String> list) {
1227+
public final Builder sort(List<SortOptions> list) {
12171228
this.sort = _listAddAll(this.sort, list);
12181229
return this;
12191230
}
12201231

12211232
/**
1222-
* A comma-separated list of <code>&lt;field&gt;:&lt;direction&gt;</code> pairs.
1233+
* A sort object that specifies the order of deleted documents.
12231234
* <p>
12241235
* API name: {@code sort}
12251236
* <p>
12261237
* Adds one or more values to <code>sort</code>.
12271238
*/
1228-
public final Builder sort(String value, String... values) {
1239+
public final Builder sort(SortOptions value, SortOptions... values) {
12291240
this.sort = _listAdd(this.sort, value, values);
12301241
return this;
12311242
}
12321243

1244+
/**
1245+
* A sort object that specifies the order of deleted documents.
1246+
* <p>
1247+
* API name: {@code sort}
1248+
* <p>
1249+
* Adds a value to <code>sort</code> using a builder lambda.
1250+
*/
1251+
public final Builder sort(Function<SortOptions.Builder, ObjectBuilder<SortOptions>> fn) {
1252+
return sort(fn.apply(new SortOptions.Builder()).build());
1253+
}
1254+
12331255
/**
12341256
* The specific <code>tag</code> of the request for logging and statistical
12351257
* purposes.
@@ -1376,6 +1398,7 @@ protected static void setupDeleteByQueryRequestDeserializer(ObjectDeserializer<D
13761398
op.add(Builder::maxDocs, JsonpDeserializer.longDeserializer(), "max_docs");
13771399
op.add(Builder::query, Query._DESERIALIZER, "query");
13781400
op.add(Builder::slice, SlicedScroll._DESERIALIZER, "slice");
1401+
op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort");
13791402

13801403
}
13811404

@@ -1494,9 +1517,6 @@ protected static void setupDeleteByQueryRequestDeserializer(ObjectDeserializer<D
14941517
if (request.refresh != null) {
14951518
params.put("refresh", String.valueOf(request.refresh));
14961519
}
1497-
if (ApiTypeHelper.isDefined(request.sort)) {
1498-
params.put("sort", request.sort.stream().map(v -> v).collect(Collectors.joining(",")));
1499-
}
15001520
if (request.searchType != null) {
15011521
params.put("search_type", request.searchType.jsonValue());
15021522
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
'_global.create.Response': '_global/create/CreateResponse.ts#L22-L24',
2828
'_global.delete.Request': '_global/delete/DeleteRequest.ts#L34-L146',
2929
'_global.delete.Response': '_global/delete/DeleteResponse.ts#L22-L34',
30-
'_global.delete_by_query.Request': '_global/delete_by_query/DeleteByQueryRequest.ts#L36-L314',
30+
'_global.delete_by_query.Request': '_global/delete_by_query/DeleteByQueryRequest.ts#L37-L319',
3131
'_global.delete_by_query.Response': '_global/delete_by_query/DeleteByQueryResponse.ts#L26-L88',
3232
'_global.delete_by_query_rethrottle.Request': '_global/delete_by_query_rethrottle/DeleteByQueryRethrottleRequest.ts#L24-L55',
3333
'_global.delete_by_query_rethrottle.Response': '_global/delete_by_query_rethrottle/DeleteByQueryRethrottleResponse.ts#L22-L24',
@@ -3321,10 +3321,10 @@
33213321
if (hash.length > 1) {
33223322
hash = hash.substring(1);
33233323
}
3324-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/cf128dc03a77fbb368c3eed4d3f86c6f428e5a92/specification/" + (paths[hash] || "");
3324+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/e8eef7137294b373ed9087eb678b3aac7d7d0d07/specification/" + (paths[hash] || "");
33253325
</script>
33263326
</head>
33273327
<body>
3328-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/cf128dc03a77fbb368c3eed4d3f86c6f428e5a92/specification/">Elasticsearch API specification</a>.
3328+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/e8eef7137294b373ed9087eb678b3aac7d7d0d07/specification/">Elasticsearch API specification</a>.
33293329
</body>
33303330
</html>

0 commit comments

Comments
 (0)