skillfed

langchain-elasticsearch

An integration package connecting Elasticsearch and LangChain

langchain-elasticsearch v1.0.0 352.7K downloads/30d#7,311 on PyPI77
Permissive license MIT Active released

What it is and what it does

langchain-elasticsearch is a LangChain integration package that bridges Elasticsearch and LangChain applications. It provides multiple components: ElasticsearchStore for vector storage and similarity search, ElasticsearchRetriever for custom query logic, ElasticsearchEmbeddings for generating embeddings using Elasticsearch-deployed models, ElasticsearchChatMessageHistory for persisting conversation state, and caching layers (ElasticsearchCache and ElasticsearchEmbeddingsCache) for reducing LLM and embedding costs.

The package depends on elasticsearch and langchain-core as its runtime dependencies. It supports Python 3.10 through 3.12 and is designed for developers building LangChain applications that need persistent, searchable storage and caching backed by Elasticsearch. Setup requires either an Elastic Cloud deployment or a self-hosted Elasticsearch instance with appropriate credentials.

Use it for:

  • Store and retrieve document embeddings in Elasticsearch for semantic search within a LangChain application.
  • Implement custom retrieval logic using ElasticsearchRetriever with fuzzy matching or other advanced Elasticsearch queries.
  • Cache LLM responses in Elasticsearch to reduce API costs and latency for repeated queries.
  • Persist chat conversation history across sessions using Elasticsearch as the backend store.
  • Generate embeddings on-demand using models deployed within an Elasticsearch cluster.
  • Cache embedding computations to avoid recomputing vectors for identical inputs.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Integrates Elasticsearch with LangChain to provide vector storage, retrieval, embeddings, chat history, and LLM caching backed by Elasticsearch.

Yes. The package has low install friction, active maintenance, permissive MIT licensing, no known vulnerabilities, and fills a clear integration gap for LangChain users who need Elasticsearch-backed storage and caching. Install it if you are building a LangChain application that requires persistent vector storage, retrieval, or LLM/embedding caching with Elasticsearch.

Install

langchain-elasticsearch on PyPI

pip

pip install langchain-elasticsearch

uv

uv add langchain-elasticsearch

poetry

poetry add langchain-elasticsearch

Installing langchain-elasticsearch

Before you install

Low friction install with only two runtime dependencies (elasticsearch and langchain-core). The package is actively maintained with a recent commit on 2026-06-26 and has been in active development since 2024-02-27.

License in practice

MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute this package freely provided you include the license notice.

Quickstart

pip install langchain-elasticsearch

from langchain_elasticsearch import ElasticsearchStore

vectorstore = ElasticsearchStore(
    es_cloud_id="your-cloud-id",
    es_api_key="your-api-key",
    index_name="your-index-name",
    embeddings=embeddings,
)

Requires a running Elasticsearch deployment (Elastic Cloud or Docker); you must provide valid Elasticsearch credentials (Cloud ID and API key or es_url).

Verify before relying

  • Whether ElasticsearchStore, ElasticsearchRetriever, and ElasticsearchEmbeddings support all LangChain vector store and retriever interfaces.
  • Performance characteristics and scalability limits for large-scale embedding and retrieval workloads.
  • Compatibility matrix with specific Elasticsearch server versions.

Package facts

License MIT (permissive)
Python support supports the current Python release (<4.0,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — elasticsearch, langchain-core
Maintenance actively maintained — 241 days since the last release
Last repo commit
First released
Downloads 352,711/month — #7,311 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: langchain_elasticsearch-1.0.0-py3-none-any.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12

Tags

elasticsearch langchain integrationvector store elasticsearchlangchain retriever elasticsearchelasticsearch embeddings cachellm cache elasticsearchchat history elasticsearchsemantic search elasticsearch
langchain-integrationvector-databaseembeddings-cache

More Artificial Intelligence packages

litellm

LiteLLM provides a unified Python interface to…

permissive · top 100 on PyPI

huggingface-hub

Client library and CLI tool for downloading,…

permissive · top 100 on PyPI

langchain

LangChain provides a framework for building…

permissive · top 1,000 on PyPI

hf-xet

hf-xet provides chunk-based deduplication and…

permissive · top 1,000 on PyPI

tokenizers

Tokenizers converts raw text into token…

permissive · top 1,000 on PyPI

transformers

Transformers provides a unified framework for…

permissive · top 1,000 on PyPI

langchain-mongodb

Connects MongoDB Atlas Vector Search to…

unclear · top 5,000 on PyPI

langchain-redis

Integrates Redis with LangChain to provide…

permissive · top 15,000 on PyPI

langchain-weaviate

Integrates Weaviate vector database with…

permissive · top 15,000 on PyPI

langchain-baseten

Integrates Baseten's chat models and embeddings…

permissive · top 15,000 on PyPI

langchain-pinecone

Connects LangChain applications to Pinecone…

permissive · top 5,000 on PyPI

langchain-plaid

Integrates NextPlaid, a ColBERT-style…

permissive · top 15,000 on PyPI

langchain-milvus

Integrates LangChain with Milvus vector…

permissive · top 15,000 on PyPI

langchain-qdrant

Connects LangChain applications to Qdrant…

permissive · top 5,000 on PyPI

llama-index-embeddings-langchain

Integrates Langchain embedding models with…

permissive · top 15,000 on PyPI

ragstack-ai-knowledge-store

Stores and retrieves LangChain documents using…

unclear · top 15,000 on PyPI