Skip to content

Commit 48bd745

Browse files
retaopensearch-trigger-bot[bot]github-actions[bot]
authored
Re-generate client code using latest OpenSearch API specification (2026-03-25) (#1938) (#1939)
(cherry picked from commit 4f37cd0) Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Andriy Redko <drreta@gmail.com> Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 31a715d commit 48bd745

25 files changed

Lines changed: 2333 additions & 269 deletions

java-client/src/generated/java/org/opensearch/client/opensearch/_types/aggregations/TermsBucketBase.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ protected TermsBucketBase(AbstractBuilder<?> builder) {
6161
}
6262

6363
/**
64+
* Upper bound of the document count error. Only present when <code>show_term_doc_count_error</code> is true.
65+
* <p>
6466
* API name: {@code doc_count_error}
67+
* </p>
6568
*/
6669
@Nullable
6770
public final Long docCountError() {
@@ -96,7 +99,10 @@ protected AbstractBuilder(AbstractBuilder<BuilderT> o) {
9699
}
97100

98101
/**
102+
* Upper bound of the document count error. Only present when <code>show_term_doc_count_error</code> is true.
103+
* <p>
99104
* API name: {@code doc_count_error}
105+
* </p>
100106
*/
101107
@Nonnull
102108
public final BuilderT docCountError(@Nullable Long value) {
Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*/
8+
9+
/*
10+
* Licensed to Elasticsearch B.V. under one or more contributor
11+
* license agreements. See the NOTICE file distributed with
12+
* this work for additional information regarding copyright
13+
* ownership. Elasticsearch B.V. licenses this file to you under
14+
* the Apache License, Version 2.0 (the "License"); you may
15+
* not use this file except in compliance with the License.
16+
* You may obtain a copy of the License at
17+
*
18+
* http://www.apache.org/licenses/LICENSE-2.0
19+
*
20+
* Unless required by applicable law or agreed to in writing,
21+
* software distributed under the License is distributed on an
22+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23+
* KIND, either express or implied. See the License for the
24+
* specific language governing permissions and limitations
25+
* under the License.
26+
*/
27+
28+
/*
29+
* Modifications Copyright OpenSearch Contributors. See
30+
* GitHub history for details.
31+
*/
32+
33+
//----------------------------------------------------
34+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
35+
//----------------------------------------------------
36+
37+
package org.opensearch.client.opensearch._types.query_dsl;
38+
39+
import jakarta.json.stream.JsonGenerator;
40+
import java.util.List;
41+
import java.util.Objects;
42+
import java.util.function.Function;
43+
import javax.annotation.Generated;
44+
import javax.annotation.Nonnull;
45+
import javax.annotation.Nullable;
46+
import org.opensearch.client.json.JsonpDeserializable;
47+
import org.opensearch.client.json.JsonpDeserializer;
48+
import org.opensearch.client.json.JsonpMapper;
49+
import org.opensearch.client.json.ObjectBuilderDeserializer;
50+
import org.opensearch.client.json.ObjectDeserializer;
51+
import org.opensearch.client.util.ApiTypeHelper;
52+
import org.opensearch.client.util.CopyableBuilder;
53+
import org.opensearch.client.util.ObjectBuilder;
54+
import org.opensearch.client.util.ToCopyableBuilder;
55+
56+
// typedef: _types.query_dsl.AgenticQuery
57+
58+
@JsonpDeserializable
59+
@Generated("org.opensearch.client.codegen.CodeGenerator")
60+
public class AgenticQuery extends QueryBase implements QueryVariant, ToCopyableBuilder<AgenticQuery.Builder, AgenticQuery> {
61+
62+
@Nullable
63+
private final String memoryId;
64+
65+
@Nonnull
66+
private final List<String> queryFields;
67+
68+
@Nonnull
69+
private final String queryText;
70+
71+
// ---------------------------------------------------------------------------------------------
72+
73+
private AgenticQuery(Builder builder) {
74+
super(builder);
75+
this.memoryId = builder.memoryId;
76+
this.queryFields = ApiTypeHelper.unmodifiable(builder.queryFields);
77+
this.queryText = ApiTypeHelper.requireNonNull(builder.queryText, this, "queryText");
78+
}
79+
80+
public static AgenticQuery of(Function<AgenticQuery.Builder, ObjectBuilder<AgenticQuery>> fn) {
81+
return fn.apply(new Builder()).build();
82+
}
83+
84+
/**
85+
* {@link Query} variant kind.
86+
*/
87+
@Override
88+
public Query.Kind _queryKind() {
89+
return Query.Kind.Agentic;
90+
}
91+
92+
/**
93+
* The memory ID from a previous response, used to continue a conversation with prior context. Applicable for conversational agents
94+
* only.
95+
* <p>
96+
* API name: {@code memory_id}
97+
* </p>
98+
*/
99+
@Nullable
100+
public final String memoryId() {
101+
return this.memoryId;
102+
}
103+
104+
/**
105+
* A list of index fields that the agent should consider when generating the search query.
106+
* <p>
107+
* API name: {@code query_fields}
108+
* </p>
109+
*/
110+
@Nonnull
111+
public final List<String> queryFields() {
112+
return this.queryFields;
113+
}
114+
115+
/**
116+
* Required - The natural language question to be answered by the agent.
117+
* <p>
118+
* API name: {@code query_text}
119+
* </p>
120+
*/
121+
@Nonnull
122+
public final String queryText() {
123+
return this.queryText;
124+
}
125+
126+
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
127+
super.serializeInternal(generator, mapper);
128+
if (this.memoryId != null) {
129+
generator.writeKey("memory_id");
130+
generator.write(this.memoryId);
131+
}
132+
133+
if (ApiTypeHelper.isDefined(this.queryFields)) {
134+
generator.writeKey("query_fields");
135+
generator.writeStartArray();
136+
for (String item0 : this.queryFields) {
137+
generator.write(item0);
138+
}
139+
generator.writeEnd();
140+
}
141+
142+
generator.writeKey("query_text");
143+
generator.write(this.queryText);
144+
}
145+
146+
// ---------------------------------------------------------------------------------------------
147+
148+
@Override
149+
@Nonnull
150+
public Builder toBuilder() {
151+
return new Builder(this);
152+
}
153+
154+
@Nonnull
155+
public static Builder builder() {
156+
return new Builder();
157+
}
158+
159+
/**
160+
* Builder for {@link AgenticQuery}.
161+
*/
162+
public static class Builder extends QueryBase.AbstractBuilder<Builder> implements CopyableBuilder<Builder, AgenticQuery> {
163+
@Nullable
164+
private String memoryId;
165+
@Nullable
166+
private List<String> queryFields;
167+
private String queryText;
168+
169+
public Builder() {}
170+
171+
private Builder(AgenticQuery o) {
172+
super(o);
173+
this.memoryId = o.memoryId;
174+
this.queryFields = _listCopy(o.queryFields);
175+
this.queryText = o.queryText;
176+
}
177+
178+
private Builder(Builder o) {
179+
super(o);
180+
this.memoryId = o.memoryId;
181+
this.queryFields = _listCopy(o.queryFields);
182+
this.queryText = o.queryText;
183+
}
184+
185+
@Override
186+
@Nonnull
187+
public Builder copy() {
188+
return new Builder(this);
189+
}
190+
191+
@Override
192+
@Nonnull
193+
protected Builder self() {
194+
return this;
195+
}
196+
197+
/**
198+
* The memory ID from a previous response, used to continue a conversation with prior context. Applicable for conversational agents
199+
* only.
200+
* <p>
201+
* API name: {@code memory_id}
202+
* </p>
203+
*/
204+
@Nonnull
205+
public final Builder memoryId(@Nullable String value) {
206+
this.memoryId = value;
207+
return this;
208+
}
209+
210+
/**
211+
* A list of index fields that the agent should consider when generating the search query.
212+
* <p>
213+
* API name: {@code query_fields}
214+
* </p>
215+
*
216+
* <p>
217+
* Adds all elements of <code>list</code> to <code>queryFields</code>.
218+
* </p>
219+
*/
220+
@Nonnull
221+
public final Builder queryFields(List<String> list) {
222+
this.queryFields = _listAddAll(this.queryFields, list);
223+
return this;
224+
}
225+
226+
/**
227+
* A list of index fields that the agent should consider when generating the search query.
228+
* <p>
229+
* API name: {@code query_fields}
230+
* </p>
231+
*
232+
* <p>
233+
* Adds one or more values to <code>queryFields</code>.
234+
* </p>
235+
*/
236+
@Nonnull
237+
public final Builder queryFields(String value, String... values) {
238+
this.queryFields = _listAdd(this.queryFields, value, values);
239+
return this;
240+
}
241+
242+
/**
243+
* Required - The natural language question to be answered by the agent.
244+
* <p>
245+
* API name: {@code query_text}
246+
* </p>
247+
*/
248+
@Nonnull
249+
public final Builder queryText(String value) {
250+
this.queryText = value;
251+
return this;
252+
}
253+
254+
/**
255+
* Builds a {@link AgenticQuery}.
256+
*
257+
* @throws NullPointerException if some of the required fields are null.
258+
*/
259+
@Override
260+
@Nonnull
261+
public AgenticQuery build() {
262+
_checkSingleUse();
263+
264+
return new AgenticQuery(this);
265+
}
266+
}
267+
268+
// ---------------------------------------------------------------------------------------------
269+
270+
/**
271+
* Json deserializer for {@link AgenticQuery}
272+
*/
273+
public static final JsonpDeserializer<AgenticQuery> _DESERIALIZER = ObjectBuilderDeserializer.lazy(
274+
Builder::new,
275+
AgenticQuery::setupAgenticQueryDeserializer
276+
);
277+
278+
protected static void setupAgenticQueryDeserializer(ObjectDeserializer<AgenticQuery.Builder> op) {
279+
setupQueryBaseDeserializer(op);
280+
op.add(Builder::memoryId, JsonpDeserializer.stringDeserializer(), "memory_id");
281+
op.add(Builder::queryFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "query_fields");
282+
op.add(Builder::queryText, JsonpDeserializer.stringDeserializer(), "query_text");
283+
}
284+
285+
@Override
286+
public int hashCode() {
287+
int result = super.hashCode();
288+
result = 31 * result + Objects.hashCode(this.memoryId);
289+
result = 31 * result + Objects.hashCode(this.queryFields);
290+
result = 31 * result + this.queryText.hashCode();
291+
return result;
292+
}
293+
294+
@Override
295+
public boolean equals(Object o) {
296+
if (!super.equals(o)) {
297+
return false;
298+
}
299+
if (this == o) return true;
300+
if (o == null || this.getClass() != o.getClass()) return false;
301+
AgenticQuery other = (AgenticQuery) o;
302+
return Objects.equals(this.memoryId, other.memoryId)
303+
&& Objects.equals(this.queryFields, other.queryFields)
304+
&& this.queryText.equals(other.queryText);
305+
}
306+
}

java-client/src/generated/java/org/opensearch/client/opensearch/_types/query_dsl/Query.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class Query implements TaggedUnion<Query.Kind, Object>, AggregationVarian
6868
* {@link Query} variant kinds.
6969
*/
7070
public enum Kind implements JsonEnum {
71+
Agentic("agentic"),
7172
Bool("bool"),
7273
Boosting("boosting"),
7374
CombinedFields("combined_fields"),
@@ -173,6 +174,22 @@ public static Query of(Function<Query.Builder, ObjectBuilder<Query>> fn) {
173174
return fn.apply(new Builder()).build();
174175
}
175176

177+
/**
178+
* Is this variant instance of kind {@code agentic}?
179+
*/
180+
public boolean isAgentic() {
181+
return _kind == Kind.Agentic;
182+
}
183+
184+
/**
185+
* Get the {@code agentic} variant value.
186+
*
187+
* @throws IllegalStateException if the current variant is not the {@code agentic} kind.
188+
*/
189+
public AgenticQuery agentic() {
190+
return TaggedUnionUtils.get(this, Kind.Agentic);
191+
}
192+
176193
/**
177194
* Is this variant instance of kind {@code bool}?
178195
*/
@@ -1127,6 +1144,16 @@ private Builder(Query o) {
11271144
this._value = o._value;
11281145
}
11291146

1147+
public ObjectBuilder<Query> agentic(AgenticQuery v) {
1148+
this._kind = Kind.Agentic;
1149+
this._value = v;
1150+
return this;
1151+
}
1152+
1153+
public ObjectBuilder<Query> agentic(Function<AgenticQuery.Builder, ObjectBuilder<AgenticQuery>> fn) {
1154+
return this.agentic(fn.apply(new AgenticQuery.Builder()).build());
1155+
}
1156+
11301157
public ObjectBuilder<Query> bool(BoolQuery v) {
11311158
this._kind = Kind.Bool;
11321159
this._value = v;
@@ -1701,6 +1728,7 @@ public Query build() {
17011728
}
17021729

17031730
protected static void setupQueryDeserializer(ObjectDeserializer<Builder> op) {
1731+
op.add(Builder::agentic, AgenticQuery._DESERIALIZER, "agentic");
17041732
op.add(Builder::bool, BoolQuery._DESERIALIZER, "bool");
17051733
op.add(Builder::boosting, BoostingQuery._DESERIALIZER, "boosting");
17061734
op.add(Builder::combinedFields, CombinedFieldsQuery._DESERIALIZER, "combined_fields");

java-client/src/generated/java/org/opensearch/client/opensearch/_types/query_dsl/QueryBuilders.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@
5050
public class QueryBuilders {
5151
private QueryBuilders() {}
5252

53+
/**
54+
* Creates a builder for the {@link AgenticQuery agentic} {@code Query} variant.
55+
*/
56+
public static AgenticQuery.Builder agentic() {
57+
return new AgenticQuery.Builder();
58+
}
59+
5360
/**
5461
* Creates a builder for the {@link BoolQuery bool} {@code Query} variant.
5562
*/

0 commit comments

Comments
 (0)