ExactKnnScriptScore#

class ExactKnnScriptScore#

exact_knn | Return a Script-Score Query to perform Cosine Similarity on dense vector fields. Requires dense_vector field with index:false being populated. Usable for project-level configuration (on stage rescore & query/retrieve), or within query-syntax (query/retrieve stage)

pydantic model PluginConfig#
Fields:
  • embedding_type (squirro.common.clients.transformers.EmbeddingDataType | None)

  • min_score (float | None)

  • text (str | None)

  • truncate_dimensions (int | None)

  • vector_field (str | None)

  • worker (str)

PluginConfig.plugin_name: ClassVar[str] = 'exact_knn'#

Used to register and reference the plugin within a query.

field PluginConfig.text: Optional[str] = ''#

Explicitly set Text as input for embeddings, otherwise overall user-query terms are injected & embedded.

field PluginConfig.worker: str = 'query-fast'#

What deployed sentence-embeddings worker (@transformer-service) should be used

field PluginConfig.embedding_type: Optional[EmbeddingDataType] = None#

The data type used to encode embeddings. Either float or byte. If set to byte, embeddings are quantized. If not set, the default type is read from the project configuration using the topic.search.default-embedding-settings config.

field PluginConfig.truncate_dimensions: Optional[int] = 0#

The dimension to truncate sentence embeddings to. 0 does no truncation. Only applicable for models that are trained with MRL.

field PluginConfig.vector_field: Optional[str] = None#

The name of the vector field in Elasticsearch used for querying e.g. 384-byte-intfloat/multilingual-e5-small.

field PluginConfig.min_score: Optional[float] = 0.0#

Documents with a score lower than this floating point number are excluded from the search results. Post-processing AFTER boost is applied