to associate with the texts.
**kwargs – Arbitrary keyword arguments.
Returns
A new ElasticKnnSearch instance.
knn_hybrid_search(query: Optional[str] = None, k: Optional[int] = 10, query_vector: Optional[List[float]] = None, model_id: Optional[str] = None, size: Optional[int] = 10, source: Optional[bool] = True, knn_boost: Optional[float] = 0.9, query_boost: Optional[float] = 0.1, fields: Optional[Union[List[Mapping[str, Any]], Tuple[Mapping[str, Any], ...]]] = None, page_content: Optional[str] = 'text') → List[Tuple[Document, float]][source]¶
Perform a hybrid k-NN and text search on the Elasticsearch index.
Parameters
query (str, optional) – The query text to search for.
k (int, optional) – The number of nearest neighbors to return.
query_vector (List[float], optional) – The query vector to search for.
model_id (str, optional) – The ID of the model to use for transforming the
query text into a vector.
size (int, optional) – The number of search results to return.
source (bool, optional) – Whether to return the source of the search results.
knn_boost (float, optional) – The boost value to apply to the k-NN search
results.
query_boost (float, optional) – The boost value to apply to the text search
results.
fields (List[Mapping[str, Any]], optional) – The fields to return in the
search results.
page_content (str, optional) – The name of the field that contains the page
content.
Returns
A list of tuples, where each tuple contains a Document object and a score.