Skip to content

Commit cd63edc

Browse files
[codegen] update to latest spec (#1220)
Co-authored-by: Laura Trotta <laura.trotta@elastic.co> Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com>
1 parent 95acbcd commit cd63edc

13 files changed

Lines changed: 379 additions & 136 deletions

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4220,9 +4220,10 @@ public final CompletableFuture<RankEvalResponse> rankEval(
42204220
* must explicitly allow the remote host using the
42214221
* <code>reindex.remote.whitelist</code> node setting on the destination
42224222
* cluster. If reindexing from a remote cluster into an Elastic Cloud Serverless
4223-
* project, only remote hosts from Elastic Cloud Hosted are allowed. Automatic
4224-
* data stream creation requires a matching index template with data stream
4225-
* enabled.
4223+
* project, only remote hosts from <a href=
4224+
* "https://cloud.elastic.co/registration?page=docs&amp;placement=docs-body">Elastic
4225+
* Cloud Hosted</a> are allowed. Automatic data stream creation requires a
4226+
* matching index template with data stream enabled.
42264227
* <p>
42274228
* The <code>dest</code> element can be configured like the index API to control
42284229
* optimistic concurrency control. Omitting <code>version_type</code> or setting
@@ -4316,9 +4317,10 @@ public CompletableFuture<ReindexResponse> reindex(ReindexRequest request) {
43164317
* must explicitly allow the remote host using the
43174318
* <code>reindex.remote.whitelist</code> node setting on the destination
43184319
* cluster. If reindexing from a remote cluster into an Elastic Cloud Serverless
4319-
* project, only remote hosts from Elastic Cloud Hosted are allowed. Automatic
4320-
* data stream creation requires a matching index template with data stream
4321-
* enabled.
4320+
* project, only remote hosts from <a href=
4321+
* "https://cloud.elastic.co/registration?page=docs&amp;placement=docs-body">Elastic
4322+
* Cloud Hosted</a> are allowed. Automatic data stream creation requires a
4323+
* matching index template with data stream enabled.
43224324
* <p>
43234325
* The <code>dest</code> element can be configured like the index API to control
43244326
* optimistic concurrency control. Omitting <code>version_type</code> or setting

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4249,9 +4249,10 @@ public final RankEvalResponse rankEval(Function<RankEvalRequest.Builder, ObjectB
42494249
* must explicitly allow the remote host using the
42504250
* <code>reindex.remote.whitelist</code> node setting on the destination
42514251
* cluster. If reindexing from a remote cluster into an Elastic Cloud Serverless
4252-
* project, only remote hosts from Elastic Cloud Hosted are allowed. Automatic
4253-
* data stream creation requires a matching index template with data stream
4254-
* enabled.
4252+
* project, only remote hosts from <a href=
4253+
* "https://cloud.elastic.co/registration?page=docs&amp;placement=docs-body">Elastic
4254+
* Cloud Hosted</a> are allowed. Automatic data stream creation requires a
4255+
* matching index template with data stream enabled.
42554256
* <p>
42564257
* The <code>dest</code> element can be configured like the index API to control
42574258
* optimistic concurrency control. Omitting <code>version_type</code> or setting
@@ -4345,9 +4346,10 @@ public ReindexResponse reindex(ReindexRequest request) throws IOException, Elast
43454346
* must explicitly allow the remote host using the
43464347
* <code>reindex.remote.whitelist</code> node setting on the destination
43474348
* cluster. If reindexing from a remote cluster into an Elastic Cloud Serverless
4348-
* project, only remote hosts from Elastic Cloud Hosted are allowed. Automatic
4349-
* data stream creation requires a matching index template with data stream
4350-
* enabled.
4349+
* project, only remote hosts from <a href=
4350+
* "https://cloud.elastic.co/registration?page=docs&amp;placement=docs-body">Elastic
4351+
* Cloud Hosted</a> are allowed. Automatic data stream creation requires a
4352+
* matching index template with data stream enabled.
43514353
* <p>
43524354
* The <code>dest</code> element can be configured like the index API to control
43534355
* optimistic concurrency control. Omitting <code>version_type</code> or setting

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public enum FieldType implements JsonEnum {
6161

6262
SearchAsYouType("search_as_you_type"),
6363

64+
Wildcard("wildcard"),
65+
6466
Date("date"),
6567

6668
DateNanos("date_nanos"),
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
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.query_dsl;
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.ApiTypeHelper;
28+
import co.elastic.clients.util.ObjectBuilder;
29+
import jakarta.json.stream.JsonGenerator;
30+
import java.lang.Long;
31+
import java.lang.String;
32+
import java.util.Objects;
33+
import java.util.function.Function;
34+
import javax.annotation.Nullable;
35+
36+
//----------------------------------------------------------------
37+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
38+
//----------------------------------------------------------------
39+
//
40+
// This code is generated from the Elasticsearch API specification
41+
// at https://github.com/elastic/elasticsearch-specification
42+
//
43+
// Manual updates to this file will be lost when the code is
44+
// re-generated.
45+
//
46+
// If you find a property that is missing or wrongly typed, please
47+
// open an issue or a PR on the API specification repository.
48+
//
49+
//----------------------------------------------------------------
50+
51+
// typedef: _types.query_dsl.LongNumberRangeQuery
52+
53+
/**
54+
*
55+
* @see <a href=
56+
* "../../doc-files/api-spec.html#_types.query_dsl.LongNumberRangeQuery">API
57+
* specification</a>
58+
*/
59+
@JsonpDeserializable
60+
public class LongNumberRangeQuery extends RangeQueryBase<Long> implements RangeQueryVariant {
61+
// Single key dictionary
62+
private final String field;
63+
64+
// ---------------------------------------------------------------------------------------------
65+
66+
private LongNumberRangeQuery(Builder builder) {
67+
super(builder);
68+
this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field");
69+
70+
}
71+
72+
public static LongNumberRangeQuery of(Function<Builder, ObjectBuilder<LongNumberRangeQuery>> fn) {
73+
return fn.apply(new Builder()).build();
74+
}
75+
76+
/**
77+
* RangeQuery variant kind.
78+
*/
79+
@Override
80+
public RangeQuery.Kind _rangeQueryKind() {
81+
return RangeQuery.Kind.LongNumber;
82+
}
83+
84+
/**
85+
* Required - the required field
86+
*/
87+
public final String field() {
88+
return this.field;
89+
}
90+
91+
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
92+
generator.writeStartObject(this.field);
93+
94+
super.serializeInternal(generator, mapper);
95+
96+
generator.writeEnd();
97+
98+
}
99+
100+
// ---------------------------------------------------------------------------------------------
101+
102+
/**
103+
* Builder for {@link LongNumberRangeQuery}.
104+
*/
105+
106+
public static class Builder extends RangeQueryBase.AbstractBuilder<Long, Builder>
107+
implements
108+
ObjectBuilder<LongNumberRangeQuery> {
109+
private String field;
110+
111+
/**
112+
* Required - the required field
113+
*/
114+
public final Builder field(String value) {
115+
this.field = value;
116+
return this;
117+
}
118+
119+
public Builder() {
120+
}
121+
private Builder(LongNumberRangeQuery instance) {
122+
123+
}
124+
@Override
125+
protected Builder self() {
126+
return this;
127+
}
128+
129+
/**
130+
* Builds a {@link LongNumberRangeQuery}.
131+
*
132+
* @throws NullPointerException
133+
* if some of the required fields are null.
134+
*/
135+
public LongNumberRangeQuery build() {
136+
_checkSingleUse();
137+
super.tSerializer(null);
138+
139+
return new LongNumberRangeQuery(this);
140+
}
141+
}
142+
143+
/**
144+
* @return New {@link Builder} initialized with field values of this instance
145+
*/
146+
public Builder rebuild() {
147+
return new Builder(this);
148+
}
149+
// ---------------------------------------------------------------------------------------------
150+
151+
/**
152+
* Json deserializer for {@link LongNumberRangeQuery}
153+
*/
154+
public static final JsonpDeserializer<LongNumberRangeQuery> _DESERIALIZER = ObjectBuilderDeserializer
155+
.lazy(Builder::new, LongNumberRangeQuery::setupLongNumberRangeQueryDeserializer);
156+
157+
protected static void setupLongNumberRangeQueryDeserializer(ObjectDeserializer<LongNumberRangeQuery.Builder> op) {
158+
RangeQueryBase.setupRangeQueryBaseDeserializer(op, JsonpDeserializer.longDeserializer());
159+
160+
op.setKey(Builder::field, JsonpDeserializer.stringDeserializer());
161+
162+
}
163+
164+
}

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public class RangeQuery
8585
public enum Kind implements JsonEnum {
8686
Date("date"),
8787

88+
LongNumber("long_number"),
89+
8890
Number("number"),
8991

9092
Term("term"),
@@ -190,6 +192,23 @@ public DateRangeQuery date() {
190192
return TaggedUnionUtils.get(this, Kind.Date);
191193
}
192194

195+
/**
196+
* Is this variant instance of kind {@code long_number}?
197+
*/
198+
public boolean isLongNumber() {
199+
return _kind == Kind.LongNumber;
200+
}
201+
202+
/**
203+
* Get the {@code long_number} variant value.
204+
*
205+
* @throws IllegalStateException
206+
* if the current variant is not of the {@code long_number} kind.
207+
*/
208+
public LongNumberRangeQuery longNumber() {
209+
return TaggedUnionUtils.get(this, Kind.LongNumber);
210+
}
211+
193212
/**
194213
* Is this variant instance of kind {@code number}?
195214
*/
@@ -267,6 +286,17 @@ public ObjectBuilder<RangeQuery> date(Function<DateRangeQuery.Builder, ObjectBui
267286
return this.date(fn.apply(new DateRangeQuery.Builder()).build());
268287
}
269288

289+
public ObjectBuilder<RangeQuery> longNumber(LongNumberRangeQuery v) {
290+
this._kind = Kind.LongNumber;
291+
this._value = v;
292+
return this;
293+
}
294+
295+
public ObjectBuilder<RangeQuery> longNumber(
296+
Function<LongNumberRangeQuery.Builder, ObjectBuilder<LongNumberRangeQuery>> fn) {
297+
return this.longNumber(fn.apply(new LongNumberRangeQuery.Builder()).build());
298+
}
299+
270300
public ObjectBuilder<RangeQuery> number(NumberRangeQuery v) {
271301
this._kind = Kind.Number;
272302
this._value = v;

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,25 @@ public static RangeQuery date(Function<DateRangeQuery.Builder, ObjectBuilder<Dat
6262
return builder.build();
6363
}
6464

65+
/**
66+
* Creates a builder for the {@link LongNumberRangeQuery long_number}
67+
* {@code RangeQuery} variant.
68+
*/
69+
public static LongNumberRangeQuery.Builder longNumber() {
70+
return new LongNumberRangeQuery.Builder();
71+
}
72+
73+
/**
74+
* Creates a RangeQuery of the {@link LongNumberRangeQuery long_number}
75+
* {@code RangeQuery} variant.
76+
*/
77+
public static RangeQuery longNumber(
78+
Function<LongNumberRangeQuery.Builder, ObjectBuilder<LongNumberRangeQuery>> fn) {
79+
RangeQuery.Builder builder = new RangeQuery.Builder();
80+
builder.longNumber(fn.apply(new LongNumberRangeQuery.Builder()).build());
81+
return builder.build();
82+
}
83+
6584
/**
6685
* Creates a builder for the {@link NumberRangeQuery number} {@code RangeQuery}
6786
* variant.

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@
101101
* must explicitly allow the remote host using the
102102
* <code>reindex.remote.whitelist</code> node setting on the destination
103103
* cluster. If reindexing from a remote cluster into an Elastic Cloud Serverless
104-
* project, only remote hosts from Elastic Cloud Hosted are allowed. Automatic
105-
* data stream creation requires a matching index template with data stream
106-
* enabled.
104+
* project, only remote hosts from <a href=
105+
* "https://cloud.elastic.co/registration?page=docs&amp;placement=docs-body">Elastic
106+
* Cloud Hosted</a> are allowed. Automatic data stream creation requires a
107+
* matching index template with data stream enabled.
107108
* <p>
108109
* The <code>dest</code> element can be configured like the index API to control
109110
* optimistic concurrency control. Omitting <code>version_type</code> or setting

0 commit comments

Comments
 (0)