
mcp/elasticsearchElasticsearch MCP Server 是一个基于 Model Context Protocol (MCP) 的 Docker 镜像,主要用途是通过自然语言对话与 Elasticsearch 索引进行交互。用户无需直接编写查询语句,可通过自然语言输入实现对 Elasticsearch 索引的查询、映射获取、分片信息查看等操作,简化与 Elasticsearch 的交互流程。
| 属性 | 详情 |
|---|---|
| Docker 镜像 | mcp/elasticsearch |
| 作者 | elastic |
| 代码仓库 | [***] |
| Dockerfile | [***] |
| 镜像构建方 | Docker Inc. |
| Docker Scout 健康评分 | !Docker Scout Health Score |
| 验证签名 | COSIGN_REPOSITORY=mcp/signatures cosign verify mcp/elasticsearch --key [***] |
| 许可证 | Apache License 2.0 |
该镜像提供以下 5 种工具,用于与 Elasticsearch 交互:
| 工具名称 | 简短描述 |
|---|---|
esql | Elasticsearch ES |
get_mappings | 获取 ES 索引映射 |
get_shards | 获取 ES 分片信息 |
list_indices | 列出 ES 索引 |
search | Elasticsearch 搜索 DSL 查询 |
运行镜像前需配置以下环境变量:
| 环境变量 | 描述 | 默认值 | 是否必填 |
|---|---|---|---|
ES_URL | Elasticsearch 服务访问 URL | http://localhost:9200 | 是 |
ES_API_KEY | 访问 Elasticsearch 的 API 密钥 | - | 是 |
通过以下命令启动容器,以标准输入输出(stdio)模式运行:
bashdocker run -i --rm \ -e ES_URL="http://localhost:9200" \ -e ES_API_KEY="your-api-key" \ mcp/elasticsearch stdio
参数说明:
-i:保持标准输入打开,支持交互模式。--rm:容器退出后自动删除,避免残留。-e:设置环境变量(ES_URL 和 ES_API_KEY)。stdio:指定 MCP 服务器以标准输入输出模式运行,用于与外部应用通信。在支持 MCP 的应用(如 Docker Compose 或 AI 应用配置)中,可通过以下 JSON 配置集成该镜像:
json{ "mcpServers": { "elasticsearch": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "ES_URL", "-e", "ES_API_KEY", "mcp/elasticsearch", "stdio" ], "env": { "ES_URL": "http://localhost:9200", "ES_API_KEY": "your-api-key" } } } }
esql功能:执行 Elasticsearch ES|QL 查询。
| 参数名 | 类型 | 描述 |
|---|---|---|
query | string | 完整的 Elasticsearch ES |
该工具为只读,不会修改环境。
get_mappings功能:获取指定 Elasticsearch 索引的字段映射。
| 参数名 | 类型 | 描述 |
|---|---|---|
index | string | 需获取映射的 Elasticsearch 索引名称 |
该工具为只读,不会修改环境。
get_shards功能:获取所有或指定索引的分片信息。
| 参数名 | 类型 | 描述 |
|---|---|---|
index | string(可选) | 可选,需获取分片信息的索引名称 |
该工具为只读,不会修改环境。
list_indices功能:列出所有可用的 Elasticsearch 索引。
| 参数名 | 类型 | 描述 |
|---|---|---|
index_pattern | string | 用于筛选索引的模式(如 log-*) |
该工具为只读,不会修改环境。
search功能:通过提供的查询 DSL 执行 Elasticsearch 搜索。
| 参数名 | 类型 | 描述 |
|---|---|---|
index | string | 需搜索的 Elasticsearch 索引名称 |
query_body | object | 完整的 Elasticsearch 查询 DSL 对象(可包含 query、size、from、sort 等) |
fields | array(可选) | 需返回的字段列表(可选) |
该工具为只读,不会修改环境。
通过以下命令验证镜像签名,确保镜像完整性:
bashCOSIGN_REPOSITORY=mcp/signatures cosign verify mcp/elasticsearch --key [***]
Docker 容器提供隔离环境,限制 MCP 服务器对主机系统的访问,降低潜在安全风险。详情参考:为什么使用 Docker 运行 MCP 服务器更安全?
本镜像基于 Apache License 2.0 许可证开源,详情参见 Apache License 2.0。


manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务