Class KnnSearchRequest
java.lang.Object
co.elastic.clients.elasticsearch._types.RequestBase
co.elastic.clients.elasticsearch.core.KnnSearchRequest
- All Implemented Interfaces:
JsonpSerializable
@JsonpDeserializable public class KnnSearchRequest extends RequestBase implements JsonpSerializable
Performs a kNN search.
- See Also:
- API specification
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKnnSearchRequest.BuilderBuilder forKnnSearchRequest.Nested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBase
RequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>> -
Field Summary
Fields Modifier and Type Field Description static JsonpDeserializer<KnnSearchRequest>_DESERIALIZERJson deserializer forKnnSearchRequeststatic SimpleEndpoint<KnnSearchRequest,?>_ENDPOINTEndpoint "knn_search". -
Method Summary
Modifier and Type Method Description static <TDocument>
Endpoint<KnnSearchRequest,KnnSearchResponse<TDocument>,ErrorResponse>createKnnSearchEndpoint(JsonpDeserializer<TDocument> tDocumentDeserializer)Create an "knn_search" endpoint.java.util.List<FieldAndFormat>docvalueFields()The request returns doc values for field names matching these patterns in the hits.fields property of the response.java.util.List<java.lang.String>fields()The request returns values for field names matching these patterns in the hits.fields property of the response.java.util.List<Query>filter()Query to filter the documents that can match.java.util.List<java.lang.String>index()Required - A comma-separated list of index names to search; use_allor to perform the operation on all indicesKnnSearchQueryknn()Required - kNN query to executestatic KnnSearchRequestof(java.util.function.Function<KnnSearchRequest.Builder,ObjectBuilder<KnnSearchRequest>> fn)java.lang.Stringrouting()A comma-separated list of specific routing valuesvoidserialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)Serialize this object to JSON.protected voidserializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)protected static voidsetupKnnSearchRequestDeserializer(ObjectDeserializer<KnnSearchRequest.Builder> op)SourceConfigsource()Indicates which source fields are returned for matching documents.java.util.List<java.lang.String>storedFields()List of stored fields to return as part of a hit.Methods inherited from class co.elastic.clients.elasticsearch._types.RequestBase
toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
_DESERIALIZER
Json deserializer forKnnSearchRequest -
_ENDPOINT
Endpoint "knn_search".
-
-
Method Details
-
of
public static KnnSearchRequest of(java.util.function.Function<KnnSearchRequest.Builder,ObjectBuilder<KnnSearchRequest>> fn) -
source
Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response.API name:
_source -
docvalueFields
The request returns doc values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns.API name:
docvalue_fields -
fields
public final java.util.List<java.lang.String> fields()The request returns values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns.API name:
fields -
filter
Query to filter the documents that can match. The kNN search will return the topkdocuments that also match this filter. The value can be a single query or a list of queries. Iffilterisn't provided, all documents are allowed to match.API name:
filter -
index
public final java.util.List<java.lang.String> index()Required - A comma-separated list of index names to search; use_allor to perform the operation on all indicesAPI name:
index -
knn
Required - kNN query to executeAPI name:
knn -
routing
@Nullable public final java.lang.String routing()A comma-separated list of specific routing valuesAPI name:
routing -
storedFields
public final java.util.List<java.lang.String> storedFields()List of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the _source parameter defaults to false. You can pass _source: true to return both source fields and stored fields in the search response.API name:
stored_fields -
serialize
Serialize this object to JSON.- Specified by:
serializein interfaceJsonpSerializable
-
serializeInternal
-
setupKnnSearchRequestDeserializer
protected static void setupKnnSearchRequestDeserializer(ObjectDeserializer<KnnSearchRequest.Builder> op) -
createKnnSearchEndpoint
public static <TDocument> Endpoint<KnnSearchRequest,KnnSearchResponse<TDocument>,ErrorResponse> createKnnSearchEndpoint(JsonpDeserializer<TDocument> tDocumentDeserializer)Create an "knn_search" endpoint.
-