java程序中使用ES knn搜索

Elasticsearch 向量搜索应用介绍_es 向量检索_文晓武的博客-CSDN博客

Elasticsearch8.x KNN search 使用方式及参数介绍_elasticsearch knn_小帅毛的博客-CSDN博客

ElasticSearch的Dense Vector_elasticsearch dense vector_若石之上的博客-CSDN博客

Elastic Search : 8.0.1
 RestClient restClient = RestClient.builder(
                new HttpHost("localhost", 9200)).build();
        ElasticsearchTransport transport = new RestClientTransport(
                restClient, new JacksonJsonpMapper());
        ElasticsearchClient client = new ElasticsearchClient(transport);
 KnnSearchQuery query = new KnnSearchQuery.Builder().field("image-vector").k(1).numCandidates(100).queryVector(v).build();
        KnnSearchRequest request = new KnnSearchRequest.Builder().knn(query).index("image_similarity_1million").fields("humanid").build();
   client.knnSearch(request,RequestOptions.DEFAULT);

你可能感兴趣的:(java,elasticsearch,数学建模)