langchain-elasticsearch
An integration package connecting Elasticsearch and LangChain
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-elasticsearchuv
uv add langchain-elasticsearchpoetry
poetry add langchain-elasticsearchInstalling 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
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
langchain-mongodbConnects MongoDB Atlas Vector Search to…
unclear · top 5,000 on PyPI
langchain-redisIntegrates Redis with LangChain to provide…
permissive · top 15,000 on PyPI
langchain-weaviateIntegrates Weaviate vector database with…
permissive · top 15,000 on PyPI
langchain-basetenIntegrates Baseten's chat models and embeddings…
permissive · top 15,000 on PyPI
langchain-pineconeConnects LangChain applications to Pinecone…
permissive · top 5,000 on PyPI
langchain-plaidIntegrates NextPlaid, a ColBERT-style…
permissive · top 15,000 on PyPI
langchain-milvusIntegrates LangChain with Milvus vector…
permissive · top 15,000 on PyPI
langchain-qdrantConnects LangChain applications to Qdrant…
permissive · top 5,000 on PyPI
llama-index-embeddings-langchainIntegrates Langchain embedding models with…
permissive · top 15,000 on PyPI
ragstack-ai-knowledge-storeStores and retrieves LangChain documents using…
unclear · top 15,000 on PyPI