Class KnnQuery

All Implemented Interfaces:

@JsonpDeserializable public class KnnQuery extends Object implements JsonpSerializable
See Also:
  • Field Details

  • Method Details

    • of

    • field

      public final String field()
      Required - The name of the vector field to search against

      API name: field

    • queryVector

      public final List<Float> queryVector()
      The query vector

      API name: query_vector

    • queryVectorBuilder

      @Nullable public final QueryVectorBuilder queryVectorBuilder()
      The query vector builder. You must provide a query_vector_builder or query_vector, but not both.

      API name: query_vector_builder

    • k

      public final long k()
      Required - The final number of nearest neighbors to return as top hits

      API name: k

    • numCandidates

      public final long numCandidates()
      Required - The number of nearest neighbor candidates to consider per shard

      API name: num_candidates

    • boost

      @Nullable public final Float boost()
      Boost value to apply to kNN scores

      API name: boost

    • filter

      public final List<Query> filter()
      Filters for the kNN search query

      API name: filter

    • serialize

      public void serialize( generator, JsonpMapper mapper)
      Serialize this object to JSON.
      Specified by:
      serialize in interface JsonpSerializable
    • serializeInternal

      protected void serializeInternal( generator, JsonpMapper mapper)
    • toString

      public String toString()
      toString in class Object
    • setupKnnQueryDeserializer

      protected static void setupKnnQueryDeserializer(ObjectDeserializer<KnnQuery.Builder> op)