--- id: langchain-elasticsearch version: "1.0.0" license: MIT license_treatment: permissive maintenance: active --- # langchain-elasticsearch — An integration package connecting Elasticsearch and LangChain License: permissive · Maintenance: active · Downloads: 352.7K/mo ## 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 above — 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 pip install langchain-elasticsearch uv add langchain-elasticsearch 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_current - Install friction: low - Maintenance: active - Downloads: 352.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags elasticsearch langchain integration, vector store elasticsearch, langchain retriever elasticsearch, elasticsearch embeddings cache, llm cache elasticsearch, chat history elasticsearch, semantic search elasticsearch, langchain-integration, vector-database, embeddings-cache [View on SkillFed](https://skillfed.io/packages/langchain-elasticsearch) · [View on PyPI](https://pypi.org/project/langchain-elasticsearch/)