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