Node Details

  • Name: Elasticsearch_VectorStores

  • Type: Elasticsearch

  • Version: 2.0

  • Category: Vector Stores

Base Classes

  • Elasticsearch

  • VectorStoreRetriever

  • BaseRetriever

Credentials

The node requires one of the following credentials:

  • elasticsearchApi

  • elasticSearchUserPassword

Input Parameters

  1. Document (optional, list)

    • Type: Document

    • Description: List of documents to be added to the vector store

  2. Embeddings

    • Type: Embeddings

    • Description: Embedding model to use for vectorizing documents

  3. Record Manager (optional)

    • Type: RecordManager

    • Description: Manages records to prevent duplication

  4. Index Name

    • Type: string

    • Description: Name of the Elasticsearch index to use

  5. Top K (optional)

    • Type: number

    • Default: 4

    • Description: Number of top results to fetch

  6. Similarity (optional)

    • Type: options

    • Default: l2_norm

    • Options: l2_norm, dot_product, cosine

    • Description: Similarity measure used in Elasticsearch

Outputs

  1. Elasticsearch Retriever

    • Type: retriever

    • Base Classes: [Elasticsearch, VectorStoreRetriever, BaseRetriever]

  2. Elasticsearch Vector Store

    • Type: vectorStore

    • Base Classes: [Elasticsearch, ElasticVectorSearch]

Functionality

Upsert Method

  • Adds or updates documents in the Elasticsearch index

  • Handles document flattening and metadata cleaning

  • Supports record management to prevent duplication

Delete Method

  • Deletes documents from the Elasticsearch index

  • Supports deletion by IDs or using a record manager

Init Method

  • Initializes the Elasticsearch vector store

  • Creates a retriever or returns the vector store based on the output type

Usage

This node is used for:

  1. Storing document embeddings in Elasticsearch

  2. Performing similarity searches on stored embeddings

  3. Retrieving relevant documents based on vector similarity

It’s particularly useful in applications requiring semantic search capabilities or when working with large datasets that need efficient similarity-based retrieval.

Note

The node includes a workaround for a bug in the underlying library (Langchain Issue #1589) where the store doesn’t support objects in metadata. It removes ‘pdf’ and ‘loc’ fields from document metadata to prevent silent failures.