Used to perform approximate nearest neighbor search using the HNSW algorithm.
At build index time, this strategy will create a dense vector field in the index and store the embedding vectors in the index.
At query time, the text will either be embedded using the provided embedding function or the query_model_id will be used to embed the text using the model deployed to Elasticsearch.
if query_model_id is used, do not provide an embedding function.
ApproxRetrievalStrategy(
query_model_id: Optional[str] = None,
hybrid: Optional[bool] = False,
rrf: Optional[Union[dict, bool]] = True
) -> ApproxRetrievalStrategy| Name | Type | Description |
|---|---|---|
query_model_id | Optional[str] | Default: NoneOptional. ID of the model to use to embed the query text within the stack. Requires embedding model to be deployed to Elasticsearch. |
hybrid | Optional[bool] | Default: FalseOptional. If True, will perform a hybrid search using both the knn query and a text query. Defaults to False. |
rrf | Optional[Union[dict, bool]] | Default: TrueOptional. rrf is Reciprocal Rank Fusion.
When |