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 class
KnnSearchRequest.Builder
Builder 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>
_DESERIALIZER
Json deserializer forKnnSearchRequest
static SimpleEndpoint<KnnSearchRequest,?>
_ENDPOINT
Endpoint "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_all
or to perform the operation on all indicesKnnSearchQuery
knn()
Required - kNN query to executestatic KnnSearchRequest
of(java.util.function.Function<KnnSearchRequest.Builder,ObjectBuilder<KnnSearchRequest>> fn)
java.lang.String
routing()
A comma-separated list of specific routing valuesvoid
serialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
Serialize this object to JSON.protected void
serializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
protected static void
setupKnnSearchRequestDeserializer(ObjectDeserializer<KnnSearchRequest.Builder> op)
SourceConfig
source()
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
toString
Methods 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 topk
documents that also match this filter. The value can be a single query or a list of queries. Iffilter
isn'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_all
or 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:
serialize
in 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.
-