Documentation Index
Fetch the complete documentation index at: https://langchain-zh.cn/llms.txt
Use this file to discover all available pages before exploring further.
title: “Elasticsearch 集成” description: “使用 LangChain Python 与 Elasticsearch 集成。”
Elasticsearch 是一个分布式的、基于 REST 的搜索和分析引擎。 它提供了一个分布式的、支持多租户的全功能文本搜索引擎,具有 HTTP Web 界面和模式无关的 JSON 文档。
安装和设置
设置 Elasticsearch
有两种方式开始使用 Elasticsearch:在本地机器上安装 Elasticsearch
在本地运行 Elasticsearch 进行开发和测试的最简单方法是使用 start-local 脚本。该脚本使用 Docker 通过简单的单行命令设置 Elasticsearch。elastic-start-local 文件夹。要启动 Elasticsearch:
http://localhost:9200 可用。elastic 用户的密码和 API 密钥会自动生成并存储在 elastic-start-local 文件夹中的 .env 文件里。
如果你只需要 Elasticsearch 而不需要 Kibana,可以使用 --esonly 选项:
start-local 设置仅用于本地测试,不应在生产环境中使用。对于生产环境安装,请参考官方 Elasticsearch 文档。
在 Elastic Cloud 上部署 Elasticsearch
Elastic Cloud 是一项托管的 Elasticsearch 服务。注册 免费试用。
安装客户端
嵌入模型
查看 使用示例。向量存储
查看 使用示例。第三方集成
EcloudESVectorStore
检索器
ElasticsearchRetriever
ElasticsearchRetriever 允许通过查询 DSL 灵活访问所有 Elasticsearch 功能。
查看 使用示例。
BM25
查看 使用示例。LLM 缓存
字节存储
查看 使用示例。链
这是一个用于与 Elasticsearch 数据库交互的链。Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

