Skip to content

Commit 650037c

Browse files
[codegen] update to latest spec (#1114)
Co-authored-by: Laura Trotta <laura.trotta@elastic.co>
1 parent b7567f4 commit 650037c

File tree

73 files changed

+4818
-2590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+4818
-2590
lines changed

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

Lines changed: 0 additions & 203 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@
6767
import co.elastic.clients.elasticsearch.core.IndexResponse;
6868
import co.elastic.clients.elasticsearch.core.InfoRequest;
6969
import co.elastic.clients.elasticsearch.core.InfoResponse;
70-
import co.elastic.clients.elasticsearch.core.KnnSearchRequest;
71-
import co.elastic.clients.elasticsearch.core.KnnSearchResponse;
7270
import co.elastic.clients.elasticsearch.core.MgetRequest;
7371
import co.elastic.clients.elasticsearch.core.MgetResponse;
7472
import co.elastic.clients.elasticsearch.core.MsearchRequest;
@@ -3282,207 +3280,6 @@ public CompletableFuture<InfoResponse> info() {
32823280
return this.transport.performRequestAsync(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions);
32833281
}
32843282

3285-
// ----- Endpoint: knn_search
3286-
3287-
/**
3288-
* Run a knn search.
3289-
* <p>
3290-
* NOTE: The kNN search API has been replaced by the <code>knn</code> option in
3291-
* the search API.
3292-
* <p>
3293-
* Perform a k-nearest neighbor (kNN) search on a dense_vector field and return
3294-
* the matching documents. Given a query vector, the API finds the k closest
3295-
* vectors and returns those documents as search hits.
3296-
* <p>
3297-
* Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like
3298-
* most kNN algorithms, HNSW is an approximate method that sacrifices result
3299-
* accuracy for improved search speed. This means the results returned are not
3300-
* always the true k closest neighbors.
3301-
* <p>
3302-
* The kNN search API supports restricting the search using a filter. The search
3303-
* will return the top k documents that also match the filter query.
3304-
* <p>
3305-
* A kNN search response has the exact same structure as a search API response.
3306-
* However, certain sections have a meaning specific to kNN search:
3307-
* <ul>
3308-
* <li>The document <code>_score</code> is determined by the similarity between
3309-
* the query and document vector.</li>
3310-
* <li>The <code>hits.total</code> object contains the total number of nearest
3311-
* neighbor candidates considered, which is
3312-
* <code>num_candidates * num_shards</code>. The
3313-
* <code>hits.total.relation</code> will always be <code>eq</code>, indicating
3314-
* an exact value.</li>
3315-
* </ul>
3316-
*
3317-
* @see <a href=
3318-
* "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/knn-search-api.html">Documentation
3319-
* on elastic.co</a>
3320-
*/
3321-
3322-
public <TDocument> CompletableFuture<KnnSearchResponse<TDocument>> knnSearch(KnnSearchRequest request,
3323-
Class<TDocument> tDocumentClass) {
3324-
@SuppressWarnings("unchecked")
3325-
JsonEndpoint<KnnSearchRequest, KnnSearchResponse<TDocument>, ErrorResponse> endpoint = (JsonEndpoint<KnnSearchRequest, KnnSearchResponse<TDocument>, ErrorResponse>) KnnSearchRequest._ENDPOINT;
3326-
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
3327-
"co.elastic.clients:Deserializer:_global.knn_search.Response.TDocument",
3328-
getDeserializer(tDocumentClass));
3329-
3330-
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
3331-
}
3332-
3333-
/**
3334-
* Run a knn search.
3335-
* <p>
3336-
* NOTE: The kNN search API has been replaced by the <code>knn</code> option in
3337-
* the search API.
3338-
* <p>
3339-
* Perform a k-nearest neighbor (kNN) search on a dense_vector field and return
3340-
* the matching documents. Given a query vector, the API finds the k closest
3341-
* vectors and returns those documents as search hits.
3342-
* <p>
3343-
* Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like
3344-
* most kNN algorithms, HNSW is an approximate method that sacrifices result
3345-
* accuracy for improved search speed. This means the results returned are not
3346-
* always the true k closest neighbors.
3347-
* <p>
3348-
* The kNN search API supports restricting the search using a filter. The search
3349-
* will return the top k documents that also match the filter query.
3350-
* <p>
3351-
* A kNN search response has the exact same structure as a search API response.
3352-
* However, certain sections have a meaning specific to kNN search:
3353-
* <ul>
3354-
* <li>The document <code>_score</code> is determined by the similarity between
3355-
* the query and document vector.</li>
3356-
* <li>The <code>hits.total</code> object contains the total number of nearest
3357-
* neighbor candidates considered, which is
3358-
* <code>num_candidates * num_shards</code>. The
3359-
* <code>hits.total.relation</code> will always be <code>eq</code>, indicating
3360-
* an exact value.</li>
3361-
* </ul>
3362-
*
3363-
* @param fn
3364-
* a function that initializes a builder to create the
3365-
* {@link KnnSearchRequest}
3366-
* @see <a href=
3367-
* "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/knn-search-api.html">Documentation
3368-
* on elastic.co</a>
3369-
*/
3370-
3371-
public final <TDocument> CompletableFuture<KnnSearchResponse<TDocument>> knnSearch(
3372-
Function<KnnSearchRequest.Builder, ObjectBuilder<KnnSearchRequest>> fn, Class<TDocument> tDocumentClass) {
3373-
return knnSearch(fn.apply(new KnnSearchRequest.Builder()).build(), tDocumentClass);
3374-
}
3375-
3376-
/**
3377-
* Overload of {@link #knnSearch(KnnSearchRequest, Class)}, where Class is
3378-
* defined as Void, meaning the documents will not be deserialized.
3379-
*/
3380-
3381-
public CompletableFuture<KnnSearchResponse<Void>> knnSearch(KnnSearchRequest request) {
3382-
@SuppressWarnings("unchecked")
3383-
JsonEndpoint<KnnSearchRequest, KnnSearchResponse<Void>, ErrorResponse> endpoint = (JsonEndpoint<KnnSearchRequest, KnnSearchResponse<Void>, ErrorResponse>) KnnSearchRequest._ENDPOINT;
3384-
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
3385-
}
3386-
3387-
/**
3388-
* Overload of {@link #knnSearch(Function, Class)}, where Class is defined as
3389-
* Void, meaning the documents will not be deserialized.
3390-
*/
3391-
3392-
public final CompletableFuture<KnnSearchResponse<Void>> knnSearch(
3393-
Function<KnnSearchRequest.Builder, ObjectBuilder<KnnSearchRequest>> fn) {
3394-
return knnSearch(fn.apply(new KnnSearchRequest.Builder()).build(), Void.class);
3395-
}
3396-
3397-
/**
3398-
* Run a knn search.
3399-
* <p>
3400-
* NOTE: The kNN search API has been replaced by the <code>knn</code> option in
3401-
* the search API.
3402-
* <p>
3403-
* Perform a k-nearest neighbor (kNN) search on a dense_vector field and return
3404-
* the matching documents. Given a query vector, the API finds the k closest
3405-
* vectors and returns those documents as search hits.
3406-
* <p>
3407-
* Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like
3408-
* most kNN algorithms, HNSW is an approximate method that sacrifices result
3409-
* accuracy for improved search speed. This means the results returned are not
3410-
* always the true k closest neighbors.
3411-
* <p>
3412-
* The kNN search API supports restricting the search using a filter. The search
3413-
* will return the top k documents that also match the filter query.
3414-
* <p>
3415-
* A kNN search response has the exact same structure as a search API response.
3416-
* However, certain sections have a meaning specific to kNN search:
3417-
* <ul>
3418-
* <li>The document <code>_score</code> is determined by the similarity between
3419-
* the query and document vector.</li>
3420-
* <li>The <code>hits.total</code> object contains the total number of nearest
3421-
* neighbor candidates considered, which is
3422-
* <code>num_candidates * num_shards</code>. The
3423-
* <code>hits.total.relation</code> will always be <code>eq</code>, indicating
3424-
* an exact value.</li>
3425-
* </ul>
3426-
*
3427-
* @see <a href=
3428-
* "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/knn-search-api.html">Documentation
3429-
* on elastic.co</a>
3430-
*/
3431-
3432-
public <TDocument> CompletableFuture<KnnSearchResponse<TDocument>> knnSearch(KnnSearchRequest request,
3433-
Type tDocumentType) {
3434-
@SuppressWarnings("unchecked")
3435-
JsonEndpoint<KnnSearchRequest, KnnSearchResponse<TDocument>, ErrorResponse> endpoint = (JsonEndpoint<KnnSearchRequest, KnnSearchResponse<TDocument>, ErrorResponse>) KnnSearchRequest._ENDPOINT;
3436-
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
3437-
"co.elastic.clients:Deserializer:_global.knn_search.Response.TDocument",
3438-
getDeserializer(tDocumentType));
3439-
3440-
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
3441-
}
3442-
3443-
/**
3444-
* Run a knn search.
3445-
* <p>
3446-
* NOTE: The kNN search API has been replaced by the <code>knn</code> option in
3447-
* the search API.
3448-
* <p>
3449-
* Perform a k-nearest neighbor (kNN) search on a dense_vector field and return
3450-
* the matching documents. Given a query vector, the API finds the k closest
3451-
* vectors and returns those documents as search hits.
3452-
* <p>
3453-
* Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like
3454-
* most kNN algorithms, HNSW is an approximate method that sacrifices result
3455-
* accuracy for improved search speed. This means the results returned are not
3456-
* always the true k closest neighbors.
3457-
* <p>
3458-
* The kNN search API supports restricting the search using a filter. The search
3459-
* will return the top k documents that also match the filter query.
3460-
* <p>
3461-
* A kNN search response has the exact same structure as a search API response.
3462-
* However, certain sections have a meaning specific to kNN search:
3463-
* <ul>
3464-
* <li>The document <code>_score</code> is determined by the similarity between
3465-
* the query and document vector.</li>
3466-
* <li>The <code>hits.total</code> object contains the total number of nearest
3467-
* neighbor candidates considered, which is
3468-
* <code>num_candidates * num_shards</code>. The
3469-
* <code>hits.total.relation</code> will always be <code>eq</code>, indicating
3470-
* an exact value.</li>
3471-
* </ul>
3472-
*
3473-
* @param fn
3474-
* a function that initializes a builder to create the
3475-
* {@link KnnSearchRequest}
3476-
* @see <a href=
3477-
* "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/knn-search-api.html">Documentation
3478-
* on elastic.co</a>
3479-
*/
3480-
3481-
public final <TDocument> CompletableFuture<KnnSearchResponse<TDocument>> knnSearch(
3482-
Function<KnnSearchRequest.Builder, ObjectBuilder<KnnSearchRequest>> fn, Type tDocumentType) {
3483-
return knnSearch(fn.apply(new KnnSearchRequest.Builder()).build(), tDocumentType);
3484-
}
3485-
34863283
// ----- Endpoint: mget
34873284

34883285
/**

0 commit comments

Comments
 (0)