Skip to content

Commit

Permalink
[codegen] update to latest spec
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta committed Dec 5, 2024
1 parent c951e5a commit 3b2c997
Show file tree
Hide file tree
Showing 70 changed files with 1,531 additions and 564 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public final CompletableFuture<ClosePointInTimeResponse> closePointInTime(
// ----- Endpoint: count

/**
* Returns number of documents matching a query.
* Count search results. Get the number of documents matching a query.
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html">Documentation
Expand All @@ -517,7 +517,7 @@ public CompletableFuture<CountResponse> count(CountRequest request) {
}

/**
* Returns number of documents matching a query.
* Count search results. Get the number of documents matching a query.
*
* @param fn
* a function that initializes a builder to create the
Expand All @@ -533,7 +533,7 @@ public final CompletableFuture<CountResponse> count(
}

/**
* Returns number of documents matching a query.
* Count search results. Get the number of documents matching a query.
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html">Documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ public final ClosePointInTimeResponse closePointInTime(
// ----- Endpoint: count

/**
* Returns number of documents matching a query.
* Count search results. Get the number of documents matching a query.
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html">Documentation
Expand All @@ -522,7 +522,7 @@ public CountResponse count(CountRequest request) throws IOException, Elasticsear
}

/**
* Returns number of documents matching a query.
* Count search results. Get the number of documents matching a query.
*
* @param fn
* a function that initializes a builder to create the
Expand All @@ -538,7 +538,7 @@ public final CountResponse count(Function<CountRequest.Builder, ObjectBuilder<Co
}

/**
* Returns number of documents matching a query.
* Count search results. Get the number of documents matching a query.
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html">Documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import co.elastic.clients.elasticsearch._types.ErrorResponse;
import co.elastic.clients.elasticsearch._types.RequestBase;
import co.elastic.clients.elasticsearch._types.Time;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.ObjectBuilderDeserializer;
Expand All @@ -31,7 +32,6 @@
import co.elastic.clients.util.ObjectBuilder;
import jakarta.json.stream.JsonGenerator;
import java.lang.String;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -70,11 +70,15 @@
public class AsyncSearchStatusRequest extends RequestBase {
private final String id;

@Nullable
private final Time keepAlive;

// ---------------------------------------------------------------------------------------------

private AsyncSearchStatusRequest(Builder builder) {

this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id");
this.keepAlive = builder.keepAlive;

}

Expand All @@ -91,6 +95,17 @@ public final String id() {
return this.id;
}

/**
* Specifies how long the async search needs to be available. Ongoing async
* searches and any saved search results are deleted after this period.
* <p>
* API name: {@code keep_alive}
*/
@Nullable
public final Time keepAlive() {
return this.keepAlive;
}

// ---------------------------------------------------------------------------------------------

/**
Expand All @@ -102,6 +117,9 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder>
ObjectBuilder<AsyncSearchStatusRequest> {
private String id;

@Nullable
private Time keepAlive;

/**
* Required - A unique identifier for the async search.
* <p>
Expand All @@ -112,6 +130,27 @@ public final Builder id(String value) {
return this;
}

/**
* Specifies how long the async search needs to be available. Ongoing async
* searches and any saved search results are deleted after this period.
* <p>
* API name: {@code keep_alive}
*/
public final Builder keepAlive(@Nullable Time value) {
this.keepAlive = value;
return this;
}

/**
* Specifies how long the async search needs to be available. Ongoing async
* searches and any saved search results are deleted after this period.
* <p>
* API name: {@code keep_alive}
*/
public final Builder keepAlive(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return this.keepAlive(fn.apply(new Time.Builder()).build());
}

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -181,7 +220,11 @@ public AsyncSearchStatusRequest build() {

// Request parameters
request -> {
return Collections.emptyMap();
Map<String, String> params = new HashMap<>();
if (request.keepAlive != null) {
params.put("keep_alive", request.keepAlive._toJsonString());
}
return params;

}, SimpleEndpoint.emptyMap(), false, AsyncSearchStatusResponse._DESERIALIZER);
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ public class SubmitRequest extends RequestBase implements JsonpSerializable {

private final List<Map<String, Double>> indicesBoost;

@Nullable
private final Time keepAlive;

@Nullable
private final Boolean keepOnCompletion;

Expand All @@ -190,9 +187,6 @@ public class SubmitRequest extends RequestBase implements JsonpSerializable {
@Nullable
private final Query postFilter;

@Nullable
private final Long preFilterShardSize;

@Nullable
private final String preference;

Expand All @@ -217,9 +211,6 @@ public class SubmitRequest extends RequestBase implements JsonpSerializable {

private final Map<String, ScriptField> scriptFields;

@Nullable
private final Time scroll;

private final List<FieldValue> searchAfter;

@Nullable
Expand Down Expand Up @@ -287,7 +278,6 @@ private SubmitRequest(Builder builder) {
this.ignoreUnavailable = builder.ignoreUnavailable;
this.index = ApiTypeHelper.unmodifiable(builder.index);
this.indicesBoost = ApiTypeHelper.unmodifiable(builder.indicesBoost);
this.keepAlive = builder.keepAlive;
this.keepOnCompletion = builder.keepOnCompletion;
this.knn = ApiTypeHelper.unmodifiable(builder.knn);
this.lenient = builder.lenient;
Expand All @@ -296,7 +286,6 @@ private SubmitRequest(Builder builder) {
this.minScore = builder.minScore;
this.pit = builder.pit;
this.postFilter = builder.postFilter;
this.preFilterShardSize = builder.preFilterShardSize;
this.preference = builder.preference;
this.profile = builder.profile;
this.q = builder.q;
Expand All @@ -306,7 +295,6 @@ private SubmitRequest(Builder builder) {
this.routing = builder.routing;
this.runtimeMappings = ApiTypeHelper.unmodifiable(builder.runtimeMappings);
this.scriptFields = ApiTypeHelper.unmodifiable(builder.scriptFields);
this.scroll = builder.scroll;
this.searchAfter = ApiTypeHelper.unmodifiable(builder.searchAfter);
this.searchType = builder.searchType;
this.seqNoPrimaryTerm = builder.seqNoPrimaryTerm;
Expand Down Expand Up @@ -554,17 +542,6 @@ public final List<Map<String, Double>> indicesBoost() {
return this.indicesBoost;
}

/**
* Specifies how long the async search needs to be available. Ongoing async
* searches and any saved search results are deleted after this period.
* <p>
* API name: {@code keep_alive}
*/
@Nullable
public final Time keepAlive() {
return this.keepAlive;
}

/**
* If <code>true</code>, results are stored for later retrieval when the search
* completes within the <code>wait_for_completion_timeout</code>.
Expand Down Expand Up @@ -646,18 +623,6 @@ public final Query postFilter() {
return this.postFilter;
}

/**
* The default value cannot be changed, which enforces the execution of a
* pre-filter roundtrip to retrieve statistics from each shard so that the ones
* that surely don’t hold any document matching the query get skipped.
* <p>
* API name: {@code pre_filter_shard_size}
*/
@Nullable
public final Long preFilterShardSize() {
return this.preFilterShardSize;
}

/**
* Specify the node or shard the operation should be performed on (default:
* random)
Expand Down Expand Up @@ -744,14 +709,6 @@ public final Map<String, ScriptField> scriptFields() {
return this.scriptFields;
}

/**
* API name: {@code scroll}
*/
@Nullable
public final Time scroll() {
return this.scroll;
}

/**
* API name: {@code search_after}
*/
Expand Down Expand Up @@ -1239,9 +1196,6 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder> impleme
@Nullable
private List<Map<String, Double>> indicesBoost;

@Nullable
private Time keepAlive;

@Nullable
private Boolean keepOnCompletion;

Expand All @@ -1266,9 +1220,6 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder> impleme
@Nullable
private Query postFilter;

@Nullable
private Long preFilterShardSize;

@Nullable
private String preference;

Expand Down Expand Up @@ -1296,9 +1247,6 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder> impleme
@Nullable
private Map<String, ScriptField> scriptFields;

@Nullable
private Time scroll;

@Nullable
private List<FieldValue> searchAfter;

Expand Down Expand Up @@ -1733,27 +1681,6 @@ public final Builder indicesBoost(Map<String, Double> value, Map<String, Double>
return this;
}

/**
* Specifies how long the async search needs to be available. Ongoing async
* searches and any saved search results are deleted after this period.
* <p>
* API name: {@code keep_alive}
*/
public final Builder keepAlive(@Nullable Time value) {
this.keepAlive = value;
return this;
}

/**
* Specifies how long the async search needs to be available. Ongoing async
* searches and any saved search results are deleted after this period.
* <p>
* API name: {@code keep_alive}
*/
public final Builder keepAlive(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return this.keepAlive(fn.apply(new Time.Builder()).build());
}

/**
* If <code>true</code>, results are stored for later retrieval when the search
* completes within the <code>wait_for_completion_timeout</code>.
Expand Down Expand Up @@ -1878,18 +1805,6 @@ public final Builder postFilter(Function<Query.Builder, ObjectBuilder<Query>> fn
return this.postFilter(fn.apply(new Query.Builder()).build());
}

/**
* The default value cannot be changed, which enforces the execution of a
* pre-filter roundtrip to retrieve statistics from each shard so that the ones
* that surely don’t hold any document matching the query get skipped.
* <p>
* API name: {@code pre_filter_shard_size}
*/
public final Builder preFilterShardSize(@Nullable Long value) {
this.preFilterShardSize = value;
return this;
}

/**
* Specify the node or shard the operation should be performed on (default:
* random)
Expand Down Expand Up @@ -2062,21 +1977,6 @@ public final Builder scriptFields(String key, Function<ScriptField.Builder, Obje
return scriptFields(key, fn.apply(new ScriptField.Builder()).build());
}

/**
* API name: {@code scroll}
*/
public final Builder scroll(@Nullable Time value) {
this.scroll = value;
return this;
}

/**
* API name: {@code scroll}
*/
public final Builder scroll(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return this.scroll(fn.apply(new Time.Builder()).build());
}

/**
* API name: {@code search_after}
* <p>
Expand Down Expand Up @@ -2544,9 +2444,6 @@ protected static void setupSubmitRequestDeserializer(ObjectDeserializer<SubmitRe
if (request.df != null) {
params.put("df", request.df);
}
if (request.preFilterShardSize != null) {
params.put("pre_filter_shard_size", String.valueOf(request.preFilterShardSize));
}
if (request.minCompatibleShardNode != null) {
params.put("min_compatible_shard_node", request.minCompatibleShardNode);
}
Expand Down Expand Up @@ -2587,9 +2484,6 @@ protected static void setupSubmitRequestDeserializer(ObjectDeserializer<SubmitRe
if (request.analyzeWildcard != null) {
params.put("analyze_wildcard", String.valueOf(request.analyzeWildcard));
}
if (request.scroll != null) {
params.put("scroll", request.scroll._toJsonString());
}
if (request.waitForCompletionTimeout != null) {
params.put("wait_for_completion_timeout", request.waitForCompletionTimeout._toJsonString());
}
Expand All @@ -2605,9 +2499,6 @@ protected static void setupSubmitRequestDeserializer(ObjectDeserializer<SubmitRe
if (request.defaultOperator != null) {
params.put("default_operator", request.defaultOperator.jsonValue());
}
if (request.keepAlive != null) {
params.put("keep_alive", request.keepAlive._toJsonString());
}
if (request.requestCache != null) {
params.put("request_cache", String.valueOf(request.requestCache));
}
Expand Down
Loading

0 comments on commit 3b2c997

Please sign in to comment.