Return Elasticsearch documents most similar to query.
similarity_search(
self,
query: str,
k: int = 4,
fetch_k: int = 50,
filter: Optional[List[dict]] = None,
*,
custom_query: Optional[Callable[[Dict[str, Any], Optional[str]], Dict[str, Any]]] = None,
doc_builder: Optional[Callable[[Dict], Document]] = None,
**kwargs: Any = {}
) -> List[Document]| Name | Type | Description |
|---|---|---|
query* | str | Text to look up documents similar to. |
k | int | Default: 4Number of Documents to return. Defaults to 4. |
fetch_k | int | Default: 50Number of Documents to fetch to pass to knn num_candidates. |
filter | Optional[List[dict]] | Default: NoneArray of Elasticsearch filter clauses to apply to the query. |