Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3359b76

Browse files
committedFeb 24, 2025·
[codegen] update to latest spec
1 parent edd1002 commit 3359b76

File tree

5 files changed

+340
-4
lines changed

5 files changed

+340
-4
lines changed
 

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,8 +1678,9 @@
16781678
'indices.validate_query.Response': 'indices/validate_query/IndicesValidateQueryResponse.ts#L23-L30',
16791679
'inference._types.CompletionResult': 'inference/_types/Results.ts#L60-L65',
16801680
'inference._types.DeleteInferenceEndpointResult': 'inference/_types/Results.ts#L91-L96',
1681-
'inference._types.InferenceEndpoint': 'inference/_types/Services.ts#L23-L39',
1682-
'inference._types.InferenceEndpointInfo': 'inference/_types/Services.ts#L41-L53',
1681+
'inference._types.InferenceChunkingSettings': 'inference/_types/Services.ts#L60-L90',
1682+
'inference._types.InferenceEndpoint': 'inference/_types/Services.ts#L24-L44',
1683+
'inference._types.InferenceEndpointInfo': 'inference/_types/Services.ts#L46-L58',
16831684
'inference._types.InferenceResult': 'inference/_types/Results.ts#L79-L89',
16841685
'inference._types.RankedDocument': 'inference/_types/Results.ts#L67-L77',
16851686
'inference._types.SparseEmbeddingResult': 'inference/_types/Results.ts#L36-L38',
@@ -2968,10 +2969,10 @@
29682969
if (hash.length > 1) {
29692970
hash = hash.substring(1);
29702971
}
2971-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/cc849b6b0bb5b01a4482c506dab7c31499c6777a/specification/" + (paths[hash] || "");
2972+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/dad39772982ddcea4178fcfd84ed02bc4c5dcecd/specification/" + (paths[hash] || "");
29722973
</script>
29732974
</head>
29742975
<body>
2975-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/cc849b6b0bb5b01a4482c506dab7c31499c6777a/specification/">Elasticsearch API specification</a>.
2976+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/dad39772982ddcea4178fcfd84ed02bc4c5dcecd/specification/">Elasticsearch API specification</a>.
29762977
</body>
29772978
</html>

‎java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/StartIlmRequest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public static StartIlmRequest of(Function<Builder, ObjectBuilder<StartIlmRequest
8585
}
8686

8787
/**
88+
* Explicit operation timeout for connection to master node
89+
* <p>
8890
* API name: {@code master_timeout}
8991
*/
9092
@Nullable
@@ -93,6 +95,8 @@ public final Time masterTimeout() {
9395
}
9496

9597
/**
98+
* Explicit operation timeout
99+
* <p>
96100
* API name: {@code timeout}
97101
*/
98102
@Nullable
@@ -114,6 +118,8 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder> impleme
114118
private Time timeout;
115119

116120
/**
121+
* Explicit operation timeout for connection to master node
122+
* <p>
117123
* API name: {@code master_timeout}
118124
*/
119125
public final Builder masterTimeout(@Nullable Time value) {
@@ -122,13 +128,17 @@ public final Builder masterTimeout(@Nullable Time value) {
122128
}
123129

124130
/**
131+
* Explicit operation timeout for connection to master node
132+
* <p>
125133
* API name: {@code master_timeout}
126134
*/
127135
public final Builder masterTimeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
128136
return this.masterTimeout(fn.apply(new Time.Builder()).build());
129137
}
130138

131139
/**
140+
* Explicit operation timeout
141+
* <p>
132142
* API name: {@code timeout}
133143
*/
134144
public final Builder timeout(@Nullable Time value) {
@@ -137,6 +147,8 @@ public final Builder timeout(@Nullable Time value) {
137147
}
138148

139149
/**
150+
* Explicit operation timeout
151+
* <p>
140152
* API name: {@code timeout}
141153
*/
142154
public final Builder timeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {

‎java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/StopIlmRequest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public static StopIlmRequest of(Function<Builder, ObjectBuilder<StopIlmRequest>>
9090
}
9191

9292
/**
93+
* Explicit operation timeout for connection to master node
94+
* <p>
9395
* API name: {@code master_timeout}
9496
*/
9597
@Nullable
@@ -98,6 +100,8 @@ public final Time masterTimeout() {
98100
}
99101

100102
/**
103+
* Explicit operation timeout
104+
* <p>
101105
* API name: {@code timeout}
102106
*/
103107
@Nullable
@@ -119,6 +123,8 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder> impleme
119123
private Time timeout;
120124

121125
/**
126+
* Explicit operation timeout for connection to master node
127+
* <p>
122128
* API name: {@code master_timeout}
123129
*/
124130
public final Builder masterTimeout(@Nullable Time value) {
@@ -127,13 +133,17 @@ public final Builder masterTimeout(@Nullable Time value) {
127133
}
128134

129135
/**
136+
* Explicit operation timeout for connection to master node
137+
* <p>
130138
* API name: {@code master_timeout}
131139
*/
132140
public final Builder masterTimeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
133141
return this.masterTimeout(fn.apply(new Time.Builder()).build());
134142
}
135143

136144
/**
145+
* Explicit operation timeout
146+
* <p>
137147
* API name: {@code timeout}
138148
*/
139149
public final Builder timeout(@Nullable Time value) {
@@ -142,6 +152,8 @@ public final Builder timeout(@Nullable Time value) {
142152
}
143153

144154
/**
155+
* Explicit operation timeout
156+
* <p>
145157
* API name: {@code timeout}
146158
*/
147159
public final Builder timeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
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.inference;
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.ObjectBuilderDeserializer;
26+
import co.elastic.clients.json.ObjectDeserializer;
27+
import co.elastic.clients.util.ObjectBuilder;
28+
import jakarta.json.stream.JsonGenerator;
29+
import java.lang.Integer;
30+
import java.lang.String;
31+
import java.util.Objects;
32+
import java.util.function.Function;
33+
import javax.annotation.Nullable;
34+
35+
//----------------------------------------------------------------
36+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
37+
//----------------------------------------------------------------
38+
//
39+
// This code is generated from the Elasticsearch API specification
40+
// at https://github.com/elastic/elasticsearch-specification
41+
//
42+
// Manual updates to this file will be lost when the code is
43+
// re-generated.
44+
//
45+
// If you find a property that is missing or wrongly typed, please
46+
// open an issue or a PR on the API specification repository.
47+
//
48+
//----------------------------------------------------------------
49+
50+
// typedef: inference._types.InferenceChunkingSettings
51+
52+
/**
53+
* Chunking configuration object
54+
*
55+
* @see <a href=
56+
* "../doc-files/api-spec.html#inference._types.InferenceChunkingSettings">API
57+
* specification</a>
58+
*/
59+
@JsonpDeserializable
60+
public class InferenceChunkingSettings extends InferenceEndpoint {
61+
@Nullable
62+
private final Integer maxChunkSize;
63+
64+
@Nullable
65+
private final Integer overlap;
66+
67+
@Nullable
68+
private final Integer sentenceOverlap;
69+
70+
@Nullable
71+
private final String strategy;
72+
73+
// ---------------------------------------------------------------------------------------------
74+
75+
private InferenceChunkingSettings(Builder builder) {
76+
super(builder);
77+
78+
this.maxChunkSize = builder.maxChunkSize;
79+
this.overlap = builder.overlap;
80+
this.sentenceOverlap = builder.sentenceOverlap;
81+
this.strategy = builder.strategy;
82+
83+
}
84+
85+
public static InferenceChunkingSettings of(Function<Builder, ObjectBuilder<InferenceChunkingSettings>> fn) {
86+
return fn.apply(new Builder()).build();
87+
}
88+
89+
/**
90+
* Specifies the maximum size of a chunk in words This value cannot be higher
91+
* than <code>300</code> or lower than <code>20</code> (for
92+
* <code>sentence</code> strategy) or <code>10</code> (for <code>word</code>
93+
* strategy)
94+
* <p>
95+
* API name: {@code max_chunk_size}
96+
*/
97+
@Nullable
98+
public final Integer maxChunkSize() {
99+
return this.maxChunkSize;
100+
}
101+
102+
/**
103+
* Specifies the number of overlapping words for chunks Only for
104+
* <code>word</code> chunking strategy This value cannot be higher than the half
105+
* of <code>max_chunk_size</code>
106+
* <p>
107+
* API name: {@code overlap}
108+
*/
109+
@Nullable
110+
public final Integer overlap() {
111+
return this.overlap;
112+
}
113+
114+
/**
115+
* Specifies the number of overlapping sentences for chunks Only for
116+
* <code>sentence</code> chunking strategy It can be either <code>1</code> or
117+
* <code>0</code>
118+
* <p>
119+
* API name: {@code sentence_overlap}
120+
*/
121+
@Nullable
122+
public final Integer sentenceOverlap() {
123+
return this.sentenceOverlap;
124+
}
125+
126+
/**
127+
* Specifies the chunking strategy It could be either <code>sentence</code> or
128+
* <code>word</code>
129+
* <p>
130+
* API name: {@code strategy}
131+
*/
132+
@Nullable
133+
public final String strategy() {
134+
return this.strategy;
135+
}
136+
137+
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
138+
139+
super.serializeInternal(generator, mapper);
140+
if (this.maxChunkSize != null) {
141+
generator.writeKey("max_chunk_size");
142+
generator.write(this.maxChunkSize);
143+
144+
}
145+
if (this.overlap != null) {
146+
generator.writeKey("overlap");
147+
generator.write(this.overlap);
148+
149+
}
150+
if (this.sentenceOverlap != null) {
151+
generator.writeKey("sentence_overlap");
152+
generator.write(this.sentenceOverlap);
153+
154+
}
155+
if (this.strategy != null) {
156+
generator.writeKey("strategy");
157+
generator.write(this.strategy);
158+
159+
}
160+
161+
}
162+
163+
// ---------------------------------------------------------------------------------------------
164+
165+
/**
166+
* Builder for {@link InferenceChunkingSettings}.
167+
*/
168+
169+
public static class Builder extends InferenceEndpoint.AbstractBuilder<Builder>
170+
implements
171+
ObjectBuilder<InferenceChunkingSettings> {
172+
@Nullable
173+
private Integer maxChunkSize;
174+
175+
@Nullable
176+
private Integer overlap;
177+
178+
@Nullable
179+
private Integer sentenceOverlap;
180+
181+
@Nullable
182+
private String strategy;
183+
184+
/**
185+
* Specifies the maximum size of a chunk in words This value cannot be higher
186+
* than <code>300</code> or lower than <code>20</code> (for
187+
* <code>sentence</code> strategy) or <code>10</code> (for <code>word</code>
188+
* strategy)
189+
* <p>
190+
* API name: {@code max_chunk_size}
191+
*/
192+
public final Builder maxChunkSize(@Nullable Integer value) {
193+
this.maxChunkSize = value;
194+
return this;
195+
}
196+
197+
/**
198+
* Specifies the number of overlapping words for chunks Only for
199+
* <code>word</code> chunking strategy This value cannot be higher than the half
200+
* of <code>max_chunk_size</code>
201+
* <p>
202+
* API name: {@code overlap}
203+
*/
204+
public final Builder overlap(@Nullable Integer value) {
205+
this.overlap = value;
206+
return this;
207+
}
208+
209+
/**
210+
* Specifies the number of overlapping sentences for chunks Only for
211+
* <code>sentence</code> chunking strategy It can be either <code>1</code> or
212+
* <code>0</code>
213+
* <p>
214+
* API name: {@code sentence_overlap}
215+
*/
216+
public final Builder sentenceOverlap(@Nullable Integer value) {
217+
this.sentenceOverlap = value;
218+
return this;
219+
}
220+
221+
/**
222+
* Specifies the chunking strategy It could be either <code>sentence</code> or
223+
* <code>word</code>
224+
* <p>
225+
* API name: {@code strategy}
226+
*/
227+
public final Builder strategy(@Nullable String value) {
228+
this.strategy = value;
229+
return this;
230+
}
231+
232+
@Override
233+
protected Builder self() {
234+
return this;
235+
}
236+
237+
/**
238+
* Builds a {@link InferenceChunkingSettings}.
239+
*
240+
* @throws NullPointerException
241+
* if some of the required fields are null.
242+
*/
243+
public InferenceChunkingSettings build() {
244+
_checkSingleUse();
245+
246+
return new InferenceChunkingSettings(this);
247+
}
248+
}
249+
250+
// ---------------------------------------------------------------------------------------------
251+
252+
/**
253+
* Json deserializer for {@link InferenceChunkingSettings}
254+
*/
255+
public static final JsonpDeserializer<InferenceChunkingSettings> _DESERIALIZER = ObjectBuilderDeserializer
256+
.lazy(Builder::new, InferenceChunkingSettings::setupInferenceChunkingSettingsDeserializer);
257+
258+
protected static void setupInferenceChunkingSettingsDeserializer(
259+
ObjectDeserializer<InferenceChunkingSettings.Builder> op) {
260+
InferenceEndpoint.setupInferenceEndpointDeserializer(op);
261+
op.add(Builder::maxChunkSize, JsonpDeserializer.integerDeserializer(), "max_chunk_size");
262+
op.add(Builder::overlap, JsonpDeserializer.integerDeserializer(), "overlap");
263+
op.add(Builder::sentenceOverlap, JsonpDeserializer.integerDeserializer(), "sentence_overlap");
264+
op.add(Builder::strategy, JsonpDeserializer.stringDeserializer(), "strategy");
265+
266+
}
267+
268+
}

‎java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceEndpoint.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
*/
6363
@JsonpDeserializable
6464
public class InferenceEndpoint implements JsonpSerializable {
65+
@Nullable
66+
private final InferenceChunkingSettings chunkingSettings;
67+
6568
private final String service;
6669

6770
private final JsonData serviceSettings;
@@ -73,6 +76,7 @@ public class InferenceEndpoint implements JsonpSerializable {
7376

7477
protected InferenceEndpoint(AbstractBuilder<?> builder) {
7578

79+
this.chunkingSettings = builder.chunkingSettings;
7680
this.service = ApiTypeHelper.requireNonNull(builder.service, this, "service");
7781
this.serviceSettings = ApiTypeHelper.requireNonNull(builder.serviceSettings, this, "serviceSettings");
7882
this.taskSettings = builder.taskSettings;
@@ -83,6 +87,16 @@ public static InferenceEndpoint inferenceEndpointOf(Function<Builder, ObjectBuil
8387
return fn.apply(new Builder()).build();
8488
}
8589

90+
/**
91+
* Chunking configuration object
92+
* <p>
93+
* API name: {@code chunking_settings}
94+
*/
95+
@Nullable
96+
public final InferenceChunkingSettings chunkingSettings() {
97+
return this.chunkingSettings;
98+
}
99+
86100
/**
87101
* Required - The service type
88102
* <p>
@@ -122,6 +136,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
122136

123137
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
124138

139+
if (this.chunkingSettings != null) {
140+
generator.writeKey("chunking_settings");
141+
this.chunkingSettings.serialize(generator, mapper);
142+
143+
}
125144
generator.writeKey("service");
126145
generator.write(this.service);
127146

@@ -171,13 +190,36 @@ public InferenceEndpoint build() {
171190
public abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<BuilderT>>
172191
extends
173192
WithJsonObjectBuilderBase<BuilderT> {
193+
@Nullable
194+
private InferenceChunkingSettings chunkingSettings;
195+
174196
private String service;
175197

176198
private JsonData serviceSettings;
177199

178200
@Nullable
179201
private JsonData taskSettings;
180202

203+
/**
204+
* Chunking configuration object
205+
* <p>
206+
* API name: {@code chunking_settings}
207+
*/
208+
public final BuilderT chunkingSettings(@Nullable InferenceChunkingSettings value) {
209+
this.chunkingSettings = value;
210+
return self();
211+
}
212+
213+
/**
214+
* Chunking configuration object
215+
* <p>
216+
* API name: {@code chunking_settings}
217+
*/
218+
public final BuilderT chunkingSettings(
219+
Function<InferenceChunkingSettings.Builder, ObjectBuilder<InferenceChunkingSettings>> fn) {
220+
return this.chunkingSettings(fn.apply(new InferenceChunkingSettings.Builder()).build());
221+
}
222+
181223
/**
182224
* Required - The service type
183225
* <p>
@@ -223,6 +265,7 @@ public final BuilderT taskSettings(@Nullable JsonData value) {
223265
protected static <BuilderT extends AbstractBuilder<BuilderT>> void setupInferenceEndpointDeserializer(
224266
ObjectDeserializer<BuilderT> op) {
225267

268+
op.add(AbstractBuilder::chunkingSettings, InferenceChunkingSettings._DESERIALIZER, "chunking_settings");
226269
op.add(AbstractBuilder::service, JsonpDeserializer.stringDeserializer(), "service");
227270
op.add(AbstractBuilder::serviceSettings, JsonData._DESERIALIZER, "service_settings");
228271
op.add(AbstractBuilder::taskSettings, JsonData._DESERIALIZER, "task_settings");

0 commit comments

Comments
 (0)
Please sign in to comment.