ElasticStore#
Info
To see example of using ElasticStore visit: How-To: Use Elastic Search to Store Similarity Index
dbally.similarity.ElasticsearchStore
#
ElasticsearchStore(index_name: str, embedding_client: EmbeddingClient, host: str, http_user: str, http_password: str, ca_cert_path: str)
Bases: SimilarityStore
The ElasticsearchStore class stores text embeddings and implements method to find the most similar values using knn algorithm.
Initializes the ElasticsearchStore.
PARAMETER | DESCRIPTION |
---|---|
index_name |
The name of the index.
TYPE:
|
embedding_client |
The client to use for creating text embeddings.
TYPE:
|
host |
The host address of the Elasticsearch instance.
TYPE:
|
http_user |
The username used for HTTP authentication.
TYPE:
|
http_password |
The password used for HTTP authentication.
TYPE:
|
ca_cert_path |
The path to the CA certificate for SSL/TLS verification.
TYPE:
|
Source code in src/dbally/similarity/elasticsearch_store.py
client
instance-attribute
#
client = AsyncElasticsearch(hosts=host, http_auth=(http_user, http_password), ca_certs=ca_cert_path)
store
async
#
Stores the data in a elastic store.
PARAMETER | DESCRIPTION |
---|---|
data |
The data to store.
TYPE:
|
Source code in src/dbally/similarity/elasticsearch_store.py
find_similar
async
#
Finds the most similar text in the store or returns None if no similar text is found.
PARAMETER | DESCRIPTION |
---|---|
text |
The text to find similar to.
TYPE:
|
k_closest |
The k nearest neighbours used by knn-search.
TYPE:
|
num_candidates |
The number of approximate nearest neighbor candidates on each shard.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[str]
|
The most similar text or None if no similar text is found. |
Source code in src/dbally/similarity/elasticsearch_store.py
dbally.similarity.ElasticVectorStore
#
ElasticVectorStore(index_name: str, host: str, http_user: str, http_password: str, ca_cert_path: str)
Bases: SimilarityStore
The Elastic Vector Store class uses the ELSER (Elastic Learned Sparse EncodeR) model on Elasticsearch to store and search data.
Initializes the Elastic Vector Store.
PARAMETER | DESCRIPTION |
---|---|
index_name |
The name of the index.
TYPE:
|
host |
The host address of the Elasticsearch instance.
TYPE:
|
http_user |
The username used for HTTP authentication.
TYPE:
|
http_password |
The password used for HTTP authentication.
TYPE:
|
ca_cert_path |
The path to the CA certificate for SSL/TLS verification.
TYPE:
|
Source code in src/dbally/similarity/elastic_vector_search.py
client
instance-attribute
#
client = AsyncElasticsearch(hosts=host, http_auth=(http_user, http_password), ca_certs=ca_cert_path)
store
async
#
Stores the given data in an Elasticsearch store.
PARAMETER | DESCRIPTION |
---|---|
data |
The data to store in the Elasticsearch index.
TYPE:
|
Source code in src/dbally/similarity/elastic_vector_search.py
find_similar
async
#
Finds the most similar stored text to the given input text.
This function performs a search in the Elasticsearch index using text expansion to find the stored text that is most similar to the provided input text.
PARAMETER | DESCRIPTION |
---|---|
text |
The input text for which to find a similar stored text.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[str]
|
The most similar stored text if found, otherwise None. |