Method to add documents to the Elasticsearch database. It first converts the documents to vectors using the embeddings, then adds the vectors to the database.
The documents to add to the database.
Optional
options: { Optional parameter that can contain the IDs for the documents.
Optional
ids?: string[]A promise that resolves with the IDs of the added documents.
Method to add vectors to the Elasticsearch database. It ensures the index exists, then adds the vectors and their corresponding documents to the database.
The vectors to add to the database.
The documents corresponding to the vectors.
Optional
options: { Optional parameter that can contain the IDs for the documents.
Optional
ids?: string[]A promise that resolves with the IDs of the added documents.
Optional
kOrFields: number | Partial<VectorStoreRetrieverInput<ElasticVectorSearch>>Optional
filter: ElasticFilterOptional
callbacks: CallbacksOptional
tags: string[]Optional
metadata: Record<string, unknown>Optional
verbose: booleanOptional
k: numberOptional
filter: ElasticFilterOptional
_callbacks: CallbacksMethod to perform a similarity search in the Elasticsearch database using a vector. It returns the k most similar documents along with their similarity scores.
The query vector.
The number of most similar documents to return.
Optional
filter: ElasticFilterOptional filter to apply to the search.
A promise that resolves with an array of tuples, where each tuple contains a Document and its similarity score.
Optional
k: numberOptional
filter: ElasticFilterOptional
_callbacks: CallbacksOptional
maxReturn documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.
Text to look up documents similar to.
Static
fromStatic method to create an ElasticVectorSearch instance from Document instances. It adds the documents to the Elasticsearch database, then returns the ElasticVectorSearch instance.
The Document instances to create the ElasticVectorSearch instance from.
The embeddings to use for the documents.
The configuration for the Elasticsearch database.
A promise that resolves with the created ElasticVectorSearch instance.
Static
fromStatic method to create an ElasticVectorSearch instance from an existing index in the Elasticsearch database. It checks if the index exists, then returns the ElasticVectorSearch instance if it does.
The embeddings to use for the documents.
The configuration for the Elasticsearch database.
A promise that resolves with the created ElasticVectorSearch instance if the index exists, otherwise it throws an error.
Static
fromStatic method to create an ElasticVectorSearch instance from texts. It creates Document instances from the texts and their corresponding metadata, then calls the fromDocuments method to create the ElasticVectorSearch instance.
The texts to create the ElasticVectorSearch instance from.
The metadata corresponding to the texts.
The embeddings to use for the documents.
The arguments to create the Elasticsearch client.
A promise that resolves with the created ElasticVectorSearch instance.
Generated using TypeDoc
Class for interacting with an Elasticsearch database. It extends the VectorStore base class and provides methods for adding documents and vectors to the Elasticsearch database, performing similarity searches, deleting documents, and more.