search(query, search_type, **kwargs)
Return docs most similar to query using specified search type.
similarity_search(query[, k, filter])
Return Elasticsearch documents most similar to query.
similarity_search_by_vector(embedding[, k])
Return docs most similar to embedding vector.
similarity_search_by_vector_with_relevance_scores(...)
Return Elasticsearch documents most similar to query, along with scores.
similarity_search_with_relevance_scores(query)
Return docs and relevance scores in the range [0, 1].
similarity_search_with_score(query[, k, filter])
Return Elasticsearch documents most similar to query, along with scores.
static ApproxRetrievalStrategy(query_model_id: Optional[str] = None, hybrid: Optional[bool] = False) → ApproxRetrievalStrategy[source]¶
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.
Parameters
query_model_id – Optional. ID of the model to use to
embed the query text within the stack. Requires
embedding model to be deployed to Elasticsearch.
hybrid – Optional. If True, will perform a hybrid search
using both the knn query and a text query.
Defaults to False.
static ExactRetrievalStrategy() → ExactRetrievalStrategy[source]¶
Used to perform brute force / exact
nearest neighbor search via script_score.
static SparseVectorRetrievalStrategy(model_id: Optional[str] = None) → SparseRetrievalStrategy[source]¶