Skip to content

Commit

Permalink
[codegen] Update to latest API spec
Browse files Browse the repository at this point in the history
  • Loading branch information
swallez committed Jun 20, 2023
1 parent 25e61a5 commit c8fdfca
Show file tree
Hide file tree
Showing 177 changed files with 20,103 additions and 2,149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
import co.elastic.clients.elasticsearch.core.GetScriptResponse;
import co.elastic.clients.elasticsearch.core.GetSourceRequest;
import co.elastic.clients.elasticsearch.core.GetSourceResponse;
import co.elastic.clients.elasticsearch.core.HealthReportRequest;
import co.elastic.clients.elasticsearch.core.HealthReportResponse;
import co.elastic.clients.elasticsearch.core.IndexRequest;
import co.elastic.clients.elasticsearch.core.IndexResponse;
import co.elastic.clients.elasticsearch.core.InfoRequest;
Expand Down Expand Up @@ -128,6 +130,7 @@
import co.elastic.clients.elasticsearch.monitoring.ElasticsearchMonitoringAsyncClient;
import co.elastic.clients.elasticsearch.nodes.ElasticsearchNodesAsyncClient;
import co.elastic.clients.elasticsearch.rollup.ElasticsearchRollupAsyncClient;
import co.elastic.clients.elasticsearch.search_application.ElasticsearchSearchApplicationAsyncClient;
import co.elastic.clients.elasticsearch.searchable_snapshots.ElasticsearchSearchableSnapshotsAsyncClient;
import co.elastic.clients.elasticsearch.security.ElasticsearchSecurityAsyncClient;
import co.elastic.clients.elasticsearch.shutdown.ElasticsearchShutdownAsyncClient;
Expand Down Expand Up @@ -257,6 +260,10 @@ public ElasticsearchRollupAsyncClient rollup() {
return new ElasticsearchRollupAsyncClient(this.transport, this.transportOptions);
}

public ElasticsearchSearchApplicationAsyncClient searchApplication() {
return new ElasticsearchSearchApplicationAsyncClient(this.transport, this.transportOptions);
}

public ElasticsearchSearchableSnapshotsAsyncClient searchableSnapshots() {
return new ElasticsearchSearchableSnapshotsAsyncClient(this.transport, this.transportOptions);
}
Expand Down Expand Up @@ -1033,6 +1040,52 @@ public final <TDocument> CompletableFuture<GetSourceResponse<TDocument>> getSour
return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentType);
}

// ----- Endpoint: health_report

/**
* Returns the health of the cluster.
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html">Documentation
* on elastic.co</a>
*/

public CompletableFuture<HealthReportResponse> healthReport(HealthReportRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint<HealthReportRequest, HealthReportResponse, ErrorResponse> endpoint = (JsonEndpoint<HealthReportRequest, HealthReportResponse, ErrorResponse>) HealthReportRequest._ENDPOINT;

return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}

/**
* Returns the health of the cluster.
*
* @param fn
* a function that initializes a builder to create the
* {@link HealthReportRequest}
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html">Documentation
* on elastic.co</a>
*/

public final CompletableFuture<HealthReportResponse> healthReport(
Function<HealthReportRequest.Builder, ObjectBuilder<HealthReportRequest>> fn) {
return healthReport(fn.apply(new HealthReportRequest.Builder()).build());
}

/**
* Returns the health of the cluster.
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html">Documentation
* on elastic.co</a>
*/

public CompletableFuture<HealthReportResponse> healthReport() {
return this.transport.performRequestAsync(new HealthReportRequest.Builder().build(),
HealthReportRequest._ENDPOINT, this.transportOptions);
}

// ----- Endpoint: index

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
import co.elastic.clients.elasticsearch.core.GetScriptResponse;
import co.elastic.clients.elasticsearch.core.GetSourceRequest;
import co.elastic.clients.elasticsearch.core.GetSourceResponse;
import co.elastic.clients.elasticsearch.core.HealthReportRequest;
import co.elastic.clients.elasticsearch.core.HealthReportResponse;
import co.elastic.clients.elasticsearch.core.IndexRequest;
import co.elastic.clients.elasticsearch.core.IndexResponse;
import co.elastic.clients.elasticsearch.core.InfoRequest;
Expand Down Expand Up @@ -129,6 +131,7 @@
import co.elastic.clients.elasticsearch.monitoring.ElasticsearchMonitoringClient;
import co.elastic.clients.elasticsearch.nodes.ElasticsearchNodesClient;
import co.elastic.clients.elasticsearch.rollup.ElasticsearchRollupClient;
import co.elastic.clients.elasticsearch.search_application.ElasticsearchSearchApplicationClient;
import co.elastic.clients.elasticsearch.searchable_snapshots.ElasticsearchSearchableSnapshotsClient;
import co.elastic.clients.elasticsearch.security.ElasticsearchSecurityClient;
import co.elastic.clients.elasticsearch.shutdown.ElasticsearchShutdownClient;
Expand Down Expand Up @@ -258,6 +261,10 @@ public ElasticsearchRollupClient rollup() {
return new ElasticsearchRollupClient(this.transport, this.transportOptions);
}

public ElasticsearchSearchApplicationClient searchApplication() {
return new ElasticsearchSearchApplicationClient(this.transport, this.transportOptions);
}

public ElasticsearchSearchableSnapshotsClient searchableSnapshots() {
return new ElasticsearchSearchableSnapshotsClient(this.transport, this.transportOptions);
}
Expand Down Expand Up @@ -1050,6 +1057,53 @@ public final <TDocument> GetSourceResponse<TDocument> getSource(
return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentType);
}

// ----- Endpoint: health_report

/**
* Returns the health of the cluster.
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html">Documentation
* on elastic.co</a>
*/

public HealthReportResponse healthReport(HealthReportRequest request) throws IOException, ElasticsearchException {
@SuppressWarnings("unchecked")
JsonEndpoint<HealthReportRequest, HealthReportResponse, ErrorResponse> endpoint = (JsonEndpoint<HealthReportRequest, HealthReportResponse, ErrorResponse>) HealthReportRequest._ENDPOINT;

return this.transport.performRequest(request, endpoint, this.transportOptions);
}

/**
* Returns the health of the cluster.
*
* @param fn
* a function that initializes a builder to create the
* {@link HealthReportRequest}
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html">Documentation
* on elastic.co</a>
*/

public final HealthReportResponse healthReport(
Function<HealthReportRequest.Builder, ObjectBuilder<HealthReportRequest>> fn)
throws IOException, ElasticsearchException {
return healthReport(fn.apply(new HealthReportRequest.Builder()).build());
}

/**
* Returns the health of the cluster.
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/health-api.html">Documentation
* on elastic.co</a>
*/

public HealthReportResponse healthReport() throws IOException, ElasticsearchException {
return this.transport.performRequest(new HealthReportRequest.Builder().build(), HealthReportRequest._ENDPOINT,
this.transportOptions);
}

// ----- Endpoint: index

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package co.elastic.clients.elasticsearch._types;

import co.elastic.clients.json.JsonEnum;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;

/**
*
* @see <a href="../doc-files/api-spec.html#_types.ClusterInfoTarget">API
* specification</a>
*/
@JsonpDeserializable
public enum ClusterInfoTarget implements JsonEnum {
All("_all"),

Http("http"),

Ingest("ingest"),

ThreadPool("thread_pool"),

Script("script"),

;

private final String jsonValue;

ClusterInfoTarget(String jsonValue) {
this.jsonValue = jsonValue;
}

public String jsonValue() {
return this.jsonValue;
}

public static final JsonEnum.Deserializer<ClusterInfoTarget> _DESERIALIZER = new JsonEnum.Deserializer<>(
ClusterInfoTarget.values());
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import co.elastic.clients.util.ObjectBuilder;
import co.elastic.clients.util.WithJsonObjectBuilderBase;
import jakarta.json.stream.JsonGenerator;
import java.lang.Double;
import java.lang.Float;
import java.lang.Long;
import java.lang.String;
Expand All @@ -55,7 +54,10 @@
public class KnnQuery implements JsonpSerializable {
private final String field;

private final List<Double> queryVector;
private final List<Float> queryVector;

@Nullable
private final QueryVectorBuilder queryVectorBuilder;

private final long k;

Expand All @@ -71,7 +73,8 @@ public class KnnQuery implements JsonpSerializable {
private KnnQuery(Builder builder) {

this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field");
this.queryVector = ApiTypeHelper.unmodifiableRequired(builder.queryVector, this, "queryVector");
this.queryVector = ApiTypeHelper.unmodifiable(builder.queryVector);
this.queryVectorBuilder = builder.queryVectorBuilder;
this.k = ApiTypeHelper.requireNonNull(builder.k, this, "k");
this.numCandidates = ApiTypeHelper.requireNonNull(builder.numCandidates, this, "numCandidates");
this.boost = builder.boost;
Expand All @@ -93,14 +96,25 @@ public final String field() {
}

/**
* Required - The query vector
* The query vector
* <p>
* API name: {@code query_vector}
*/
public final List<Double> queryVector() {
public final List<Float> queryVector() {
return this.queryVector;
}

/**
* The query vector builder. You must provide a query_vector_builder or
* query_vector, but not both.
* <p>
* API name: {@code query_vector_builder}
*/
@Nullable
public final QueryVectorBuilder queryVectorBuilder() {
return this.queryVectorBuilder;
}

/**
* Required - The final number of nearest neighbors to return as top hits
* <p>
Expand Down Expand Up @@ -155,12 +169,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (ApiTypeHelper.isDefined(this.queryVector)) {
generator.writeKey("query_vector");
generator.writeStartArray();
for (Double item0 : this.queryVector) {
for (Float item0 : this.queryVector) {
generator.write(item0);

}
generator.writeEnd();

}
if (this.queryVectorBuilder != null) {
generator.writeKey("query_vector_builder");
this.queryVectorBuilder.serialize(generator, mapper);

}
generator.writeKey("k");
generator.write(this.k);
Expand Down Expand Up @@ -200,7 +219,11 @@ public String toString() {
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<KnnQuery> {
private String field;

private List<Double> queryVector;
@Nullable
private List<Float> queryVector;

@Nullable
private QueryVectorBuilder queryVectorBuilder;

private Long k;

Expand All @@ -223,29 +246,51 @@ public final Builder field(String value) {
}

/**
* Required - The query vector
* The query vector
* <p>
* API name: {@code query_vector}
* <p>
* Adds all elements of <code>list</code> to <code>queryVector</code>.
*/
public final Builder queryVector(List<Double> list) {
public final Builder queryVector(List<Float> list) {
this.queryVector = _listAddAll(this.queryVector, list);
return this;
}

/**
* Required - The query vector
* The query vector
* <p>
* API name: {@code query_vector}
* <p>
* Adds one or more values to <code>queryVector</code>.
*/
public final Builder queryVector(Double value, Double... values) {
public final Builder queryVector(Float value, Float... values) {
this.queryVector = _listAdd(this.queryVector, value, values);
return this;
}

/**
* The query vector builder. You must provide a query_vector_builder or
* query_vector, but not both.
* <p>
* API name: {@code query_vector_builder}
*/
public final Builder queryVectorBuilder(@Nullable QueryVectorBuilder value) {
this.queryVectorBuilder = value;
return this;
}

/**
* The query vector builder. You must provide a query_vector_builder or
* query_vector, but not both.
* <p>
* API name: {@code query_vector_builder}
*/
public final Builder queryVectorBuilder(
Function<QueryVectorBuilder.Builder, ObjectBuilder<QueryVectorBuilder>> fn) {
return this.queryVectorBuilder(fn.apply(new QueryVectorBuilder.Builder()).build());
}

/**
* Required - The final number of nearest neighbors to return as top hits
* <p>
Expand Down Expand Up @@ -340,8 +385,9 @@ public KnnQuery build() {
protected static void setupKnnQueryDeserializer(ObjectDeserializer<KnnQuery.Builder> op) {

op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field");
op.add(Builder::queryVector, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()),
op.add(Builder::queryVector, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.floatDeserializer()),
"query_vector");
op.add(Builder::queryVectorBuilder, QueryVectorBuilder._DESERIALIZER, "query_vector_builder");
op.add(Builder::k, JsonpDeserializer.longDeserializer(), "k");
op.add(Builder::numCandidates, JsonpDeserializer.longDeserializer(), "num_candidates");
op.add(Builder::boost, JsonpDeserializer.floatDeserializer(), "boost");
Expand Down
Loading

0 comments on commit c8fdfca

Please sign in to comment.