Classes
CLASS ElasticsearchRetriever
Retriever for documents hosted on an Elasticsearch server.
Queries an Elasticsearch index using the ELSER sparse-vector model to
retrieve the top-k matching documents for a given natural language query.
Attributes:
hosts: Fullurl\:portconnection string to the Elasticsearch server; stored from thehostconstructor argument.
corpus_name: Name of the Elasticsearch index to query.host: Fullurl\:portconnection string to the Elasticsearch server.**kwargs: Additional keyword arguments forwarded to theElasticsearchclient constructor.
FUNC create_es_body
limit: Maximum number of documents to retrieve.query: Natural language query string used for ELSER sparse-vector retrieval.
FUNC retrieve
query: Natural language query string to search for.top_k: Maximum number of documents to return. Defaults to5.
- list[dict]: List of matching documents, each with keys
doc_id,text, andscore.