Skip to content

Commit e77cee1

Browse files
committed
Merge branch 'main' of github.com:marciw/elasticsearch-java
2 parents 98bc920 + 19ca1b9 commit e77cee1

File tree

114 files changed

+10644
-3516
lines changed

Some content is hidden

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

114 files changed

+10644
-3516
lines changed

java-client/build.gradle.kts

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ forbiddenApis {
5656
suppressAnnotations = setOf("co.elastic.clients.util.AllowForbiddenApis")
5757
}
5858

59+
tasks.compileJava {
60+
options.release.set(17)
61+
}
62+
5963
tasks.forbiddenApisMain {
6064
bundledSignatures = setOf("jdk-system-out")
6165
}
@@ -158,29 +162,6 @@ publishing {
158162
developerConnection.set("scm:git:ssh://[email protected]:elastic/elasticsearch-java.git")
159163
url.set("https://github.com/elastic/elasticsearch-java/")
160164
}
161-
162-
withXml {
163-
// Note: org.elasticsearch.client is now an optional dependency, so the below is no more useful.
164-
// It's kept in case it ever comes back as a required dependency.
165-
166-
// Set the version of dependencies of the org.elasticsearch.client group to the one that we are building.
167-
// Since the unified release process releases everything at once, this ensures all published artifacts depend
168-
// on the exact same version. This assumes of course that the binary API and the behavior of these dependencies
169-
// are the same as the one used in the dependency section below.
170-
val xPathFactory = javax.xml.xpath.XPathFactory.newInstance()
171-
val depSelector = xPathFactory.newXPath()
172-
.compile("/project/dependencies/dependency[groupId/text() = 'org.elasticsearch.client']")
173-
val versionSelector = xPathFactory.newXPath().compile("version")
174-
175-
val deps = depSelector.evaluate(asElement().ownerDocument, javax.xml.xpath.XPathConstants.NODESET)
176-
as org.w3c.dom.NodeList
177-
178-
for (i in 0 until deps.length) {
179-
val dep = deps.item(i)
180-
val version = versionSelector.evaluate(dep, javax.xml.xpath.XPathConstants.NODE) as org.w3c.dom.Element
181-
version.textContent = project.version.toString()
182-
}
183-
}
184165
}
185166
}
186167
}
@@ -196,7 +177,7 @@ signing {
196177
dependencies {
197178
// Compile and test with the last 8.x version to make sure transition scenarios where
198179
// the Java API client coexists with a 8.x HLRC work fine
199-
val elasticsearchVersion = "8.17.0"
180+
val elasticsearchVersion = "9.0.0"
200181
val jacksonVersion = "2.18.3"
201182
val openTelemetryVersion = "1.29.0"
202183

@@ -205,7 +186,9 @@ dependencies {
205186
compileOnly("org.elasticsearch.client", "elasticsearch-rest-client", elasticsearchVersion)
206187
testImplementation("org.elasticsearch.client", "elasticsearch-rest-client", elasticsearchVersion)
207188

208-
api("org.apache.httpcomponents.client5","httpclient5","5.4")
189+
// Apache 2.0
190+
// https://hc.apache.org/httpcomponents-client-ga/
191+
api("org.apache.httpcomponents.client5","httpclient5","5.4.4")
209192

210193
// Apache 2.0
211194
// https://search.maven.org/artifact/com.google.code.findbugs/jsr305
@@ -220,6 +203,10 @@ dependencies {
220203
// https://github.com/eclipse-ee4j/parsson
221204
api("org.eclipse.parsson:parsson:1.1.7")
222205

206+
// Apache 2.0
207+
// http://commons.apache.org/logging/
208+
api("commons-logging:commons-logging:1.3.5")
209+
223210
// OpenTelemetry API for native instrumentation of the client.
224211
// Apache 2.0
225212
// https://github.com/open-telemetry/opentelemetry-java
@@ -288,6 +275,7 @@ class SpdxReporter(val dest: File) : ReportRenderer {
288275
"The Apache License, Version 2.0" to "Apache-2.0",
289276
"Apache License, Version 2.0" to "Apache-2.0",
290277
"The Apache Software License, Version 2.0" to "Apache-2.0",
278+
"Apache-2.0" to "Apache-2.0",
291279
"MIT License" to "MIT",
292280
"BSD Zero Clause License" to "0BSD",
293281
"Eclipse Public License 2.0" to "EPL-2.0",

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;
@@ -3284,207 +3282,6 @@ public CompletableFuture<InfoResponse> info() {
32843282
return this.transport.performRequestAsync(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions);
32853283
}
32863284

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-
34883285
// ----- Endpoint: mget
34893286

34903287
/**

0 commit comments

Comments
 (0)