Skip to content

Commit d440611

Browse files
committed
[codegen] update to latest spec
1 parent 09aad7b commit d440611

File tree

78 files changed

+7555
-389
lines changed

Some content is hidden

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

78 files changed

+7555
-389
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
import co.elastic.clients.elasticsearch.snapshot.ElasticsearchSnapshotAsyncClient;
138138
import co.elastic.clients.elasticsearch.sql.ElasticsearchSqlAsyncClient;
139139
import co.elastic.clients.elasticsearch.ssl.ElasticsearchSslAsyncClient;
140+
import co.elastic.clients.elasticsearch.streams.ElasticsearchStreamsAsyncClient;
140141
import co.elastic.clients.elasticsearch.synonyms.ElasticsearchSynonymsAsyncClient;
141142
import co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksAsyncClient;
142143
import co.elastic.clients.elasticsearch.text_structure.ElasticsearchTextStructureAsyncClient;
@@ -346,6 +347,10 @@ public ElasticsearchSslAsyncClient ssl() {
346347
return new ElasticsearchSslAsyncClient(this.transport, this.transportOptions);
347348
}
348349

350+
public ElasticsearchStreamsAsyncClient streams() {
351+
return new ElasticsearchStreamsAsyncClient(this.transport, this.transportOptions);
352+
}
353+
349354
public ElasticsearchSynonymsAsyncClient synonyms() {
350355
return new ElasticsearchSynonymsAsyncClient(this.transport, this.transportOptions);
351356
}

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
import co.elastic.clients.elasticsearch.snapshot.ElasticsearchSnapshotClient;
139139
import co.elastic.clients.elasticsearch.sql.ElasticsearchSqlClient;
140140
import co.elastic.clients.elasticsearch.ssl.ElasticsearchSslClient;
141+
import co.elastic.clients.elasticsearch.streams.ElasticsearchStreamsClient;
141142
import co.elastic.clients.elasticsearch.synonyms.ElasticsearchSynonymsClient;
142143
import co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksClient;
143144
import co.elastic.clients.elasticsearch.text_structure.ElasticsearchTextStructureClient;
@@ -346,6 +347,10 @@ public ElasticsearchSslClient ssl() {
346347
return new ElasticsearchSslClient(this.transport, this.transportOptions);
347348
}
348349

350+
public ElasticsearchStreamsClient streams() {
351+
return new ElasticsearchStreamsClient(this.transport, this.transportOptions);
352+
}
353+
349354
public ElasticsearchSynonymsClient synonyms() {
350355
return new ElasticsearchSynonymsClient(this.transport, this.transportOptions);
351356
}
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
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;
21+
22+
import co.elastic.clients.json.JsonpDeserializable;
23+
import co.elastic.clients.json.JsonpDeserializer;
24+
import co.elastic.clients.json.JsonpMapper;
25+
import co.elastic.clients.json.JsonpSerializable;
26+
import co.elastic.clients.json.JsonpUtils;
27+
import co.elastic.clients.json.ObjectBuilderDeserializer;
28+
import co.elastic.clients.json.ObjectDeserializer;
29+
import co.elastic.clients.util.ApiTypeHelper;
30+
import co.elastic.clients.util.ObjectBuilder;
31+
import co.elastic.clients.util.WithJsonObjectBuilderBase;
32+
import jakarta.json.stream.JsonGenerator;
33+
import java.lang.Double;
34+
import java.util.Objects;
35+
import java.util.function.Function;
36+
37+
//----------------------------------------------------------------
38+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
39+
//----------------------------------------------------------------
40+
//
41+
// This code is generated from the Elasticsearch API specification
42+
// at https://github.com/elastic/elasticsearch-specification
43+
//
44+
// Manual updates to this file will be lost when the code is
45+
// re-generated.
46+
//
47+
// If you find a property that is missing or wrongly typed, please
48+
// open an issue or a PR on the API specification repository.
49+
//
50+
//----------------------------------------------------------------
51+
52+
// typedef: _types.CartesianPoint
53+
54+
/**
55+
*
56+
* @see <a href="../doc-files/api-spec.html#_types.CartesianPoint">API
57+
* specification</a>
58+
*/
59+
@JsonpDeserializable
60+
public class CartesianPoint implements JsonpSerializable {
61+
private final double x;
62+
63+
private final double y;
64+
65+
// ---------------------------------------------------------------------------------------------
66+
67+
private CartesianPoint(Builder builder) {
68+
69+
this.x = ApiTypeHelper.requireNonNull(builder.x, this, "x", 0);
70+
this.y = ApiTypeHelper.requireNonNull(builder.y, this, "y", 0);
71+
72+
}
73+
74+
public static CartesianPoint of(Function<Builder, ObjectBuilder<CartesianPoint>> fn) {
75+
return fn.apply(new Builder()).build();
76+
}
77+
78+
/**
79+
* Required - API name: {@code x}
80+
*/
81+
public final double x() {
82+
return this.x;
83+
}
84+
85+
/**
86+
* Required - API name: {@code y}
87+
*/
88+
public final double y() {
89+
return this.y;
90+
}
91+
92+
/**
93+
* Serialize this object to JSON.
94+
*/
95+
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
96+
generator.writeStartObject();
97+
serializeInternal(generator, mapper);
98+
generator.writeEnd();
99+
}
100+
101+
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
102+
103+
generator.writeKey("x");
104+
generator.write(this.x);
105+
106+
generator.writeKey("y");
107+
generator.write(this.y);
108+
109+
}
110+
111+
@Override
112+
public String toString() {
113+
return JsonpUtils.toString(this);
114+
}
115+
116+
// ---------------------------------------------------------------------------------------------
117+
118+
/**
119+
* Builder for {@link CartesianPoint}.
120+
*/
121+
122+
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<CartesianPoint> {
123+
private Double x;
124+
125+
private Double y;
126+
127+
/**
128+
* Required - API name: {@code x}
129+
*/
130+
public final Builder x(double value) {
131+
this.x = value;
132+
return this;
133+
}
134+
135+
/**
136+
* Required - API name: {@code y}
137+
*/
138+
public final Builder y(double value) {
139+
this.y = value;
140+
return this;
141+
}
142+
143+
@Override
144+
protected Builder self() {
145+
return this;
146+
}
147+
148+
/**
149+
* Builds a {@link CartesianPoint}.
150+
*
151+
* @throws NullPointerException
152+
* if some of the required fields are null.
153+
*/
154+
public CartesianPoint build() {
155+
_checkSingleUse();
156+
157+
return new CartesianPoint(this);
158+
}
159+
}
160+
161+
// ---------------------------------------------------------------------------------------------
162+
163+
/**
164+
* Json deserializer for {@link CartesianPoint}
165+
*/
166+
public static final JsonpDeserializer<CartesianPoint> _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new,
167+
CartesianPoint::setupCartesianPointDeserializer);
168+
169+
protected static void setupCartesianPointDeserializer(ObjectDeserializer<CartesianPoint.Builder> op) {
170+
171+
op.add(Builder::x, JsonpDeserializer.doubleDeserializer(), "x");
172+
op.add(Builder::y, JsonpDeserializer.doubleDeserializer(), "y");
173+
174+
}
175+
176+
}

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

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -302,48 +302,57 @@ public SortOptions build() {
302302
return new SortOptions(this);
303303
}
304304

305+
@Override
306+
public Builder withJson(JsonParser parser, JsonpMapper mapper) {
307+
deserializeBuilder(this, parser.next(), parser, mapper);
308+
return this;
309+
}
305310
}
306311

307312
public static final JsonpDeserializer<SortOptions> _DESERIALIZER = JsonpDeserializer.lazy(() -> JsonpDeserializer
308313
.of(EnumSet.of(JsonParser.Event.START_OBJECT, JsonParser.Event.VALUE_STRING), (parser, mapper, event) -> {
309314
SortOptions.Builder b = new SortOptions.Builder();
310-
311-
if (event == JsonParser.Event.VALUE_STRING) {
312-
switch (parser.getString()) {
313-
case "_score" :
314-
b.score(s -> s);
315-
break;
316-
case "_doc" :
317-
b.doc(d -> d);
318-
break;
319-
default :
320-
b.field(f -> f.field(parser.getString()));
321-
}
322-
return b.build();
323-
}
324-
325-
JsonpUtils.expectEvent(parser, JsonParser.Event.START_OBJECT, event);
326-
JsonpUtils.expectNextEvent(parser, JsonParser.Event.KEY_NAME);
327-
switch (parser.getString()) {
328-
case "_score" :
329-
b.score(ScoreSort._DESERIALIZER.deserialize(parser, mapper));
330-
break;
331-
case "_doc" :
332-
b.doc(ScoreSort._DESERIALIZER.deserialize(parser, mapper));
333-
break;
334-
case "_geo_distance" :
335-
b.geoDistance(GeoDistanceSort._DESERIALIZER.deserialize(parser, mapper));
336-
break;
337-
case "_script" :
338-
b.script(ScriptSort._DESERIALIZER.deserialize(parser, mapper));
339-
break;
340-
default :
341-
// Consumes END_OBJECT
342-
return b.field(FieldSort._DESERIALIZER.deserialize(parser, mapper, JsonParser.Event.KEY_NAME))
343-
.build();
344-
}
345-
346-
JsonpUtils.expectNextEvent(parser, JsonParser.Event.END_OBJECT);
315+
deserializeBuilder(b, event, parser, mapper);
347316
return b.build();
348317
}));
318+
319+
private static void deserializeBuilder(SortOptions.Builder b, JsonParser.Event event, JsonParser parser,
320+
JsonpMapper mapper) {
321+
if (event == JsonParser.Event.VALUE_STRING) {
322+
switch (parser.getString()) {
323+
case "_score" :
324+
b.score(s -> s);
325+
break;
326+
case "_doc" :
327+
b.doc(d -> d);
328+
break;
329+
default :
330+
b.field(f -> f.field(parser.getString()));
331+
}
332+
return;
333+
}
334+
335+
JsonpUtils.expectEvent(parser, JsonParser.Event.START_OBJECT, event);
336+
JsonpUtils.expectNextEvent(parser, JsonParser.Event.KEY_NAME);
337+
switch (parser.getString()) {
338+
case "_score" :
339+
b.score(ScoreSort._DESERIALIZER.deserialize(parser, mapper));
340+
break;
341+
case "_doc" :
342+
b.doc(ScoreSort._DESERIALIZER.deserialize(parser, mapper));
343+
break;
344+
case "_geo_distance" :
345+
b.geoDistance(GeoDistanceSort._DESERIALIZER.deserialize(parser, mapper));
346+
break;
347+
case "_script" :
348+
b.script(ScriptSort._DESERIALIZER.deserialize(parser, mapper));
349+
break;
350+
default :
351+
// Consumes END_OBJECT
352+
b.field(FieldSort._DESERIALIZER.deserialize(parser, mapper, JsonParser.Event.KEY_NAME));
353+
return;
354+
}
355+
356+
JsonpUtils.expectNextEvent(parser, JsonParser.Event.END_OBJECT);
357+
}
349358
}

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
*/
6060
@JsonpDeserializable
6161
public class TextEmbedding implements QueryVectorBuilderVariant, JsonpSerializable {
62+
@Nullable
6263
private final String modelId;
6364

6465
private final String modelText;
@@ -67,7 +68,7 @@ public class TextEmbedding implements QueryVectorBuilderVariant, JsonpSerializab
6768

6869
private TextEmbedding(Builder builder) {
6970

70-
this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId");
71+
this.modelId = builder.modelId;
7172
this.modelText = ApiTypeHelper.requireNonNull(builder.modelText, this, "modelText");
7273

7374
}
@@ -85,8 +86,12 @@ public QueryVectorBuilder.Kind _queryVectorBuilderKind() {
8586
}
8687

8788
/**
88-
* Required - API name: {@code model_id}
89+
* Model ID is required for all dense_vector fields but may be inferred for
90+
* semantic_text fields
91+
* <p>
92+
* API name: {@code model_id}
8993
*/
94+
@Nullable
9095
public final String modelId() {
9196
return this.modelId;
9297
}
@@ -109,9 +114,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
109114

110115
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
111116

112-
generator.writeKey("model_id");
113-
generator.write(this.modelId);
117+
if (this.modelId != null) {
118+
generator.writeKey("model_id");
119+
generator.write(this.modelId);
114120

121+
}
115122
generator.writeKey("model_text");
116123
generator.write(this.modelText);
117124

@@ -129,14 +136,18 @@ public String toString() {
129136
*/
130137

131138
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<TextEmbedding> {
139+
@Nullable
132140
private String modelId;
133141

134142
private String modelText;
135143

136144
/**
137-
* Required - API name: {@code model_id}
145+
* Model ID is required for all dense_vector fields but may be inferred for
146+
* semantic_text fields
147+
* <p>
148+
* API name: {@code model_id}
138149
*/
139-
public final Builder modelId(String value) {
150+
public final Builder modelId(@Nullable String value) {
140151
this.modelId = value;
141152
return this;
142153
}

0 commit comments

Comments
 (0)