
Claude Code 技能用于与 Elasticsearch REST API 交互——查询 DSL、聚合、集群运算、ILM、ES|QL 等
概览
这是一个基于 markdown 的技能,教 Claude Code 如何通过 REST API 与 Elasticsearch 集互。没有 SDK,没有客户端库,没有 MCP 服务器——只有 curl 和知识。 Claude Code 是从本地目录加载技能,而不是从 GitHub URL 加载。克隆这个仓库,然后将文件复制到支持的技能位置之一。 在你项目的根目录中: 然后把 .claude/skills/elasticsearch/ 目录提交到你的仓库,这样你的团队也能拿到。 重启Claude代码,然后检查技能是否已加载: 你应该会在列表中看到elasticsearch。 在 ~/.claude/settings.json 的技能数组中添加 GitHub URL,确实有效。技能必须是本地文件——没有远程获取。 在开始使用 Claude Code 之前,先将你的集群凭证设置为环境变量:
概述(AI 翻译)
这是一个基于 markdown 的技能,教 Claude Code 如何通过 REST API 与 Elasticsearch 集互。没有 SDK,没有客户端库,没有 MCP 服务器——只有 curl 和知识。
里面有什么
| 文件 | 内容 |
|---|---|
SKILL.md |
授权、搜索、CRUD、批量操作、索引管理、集群健康、ILM、ES|QL,导入管道 |
references/query-dsl.md |
全查询DSL — bool、match、term、range、nested、geo、wildcard、runtime fields、search_after |
references/aggregations.md |
度量、桶和管道聚合——以及SRE模式(错误率、前N个排行榜) |
安装
Claude Code 是从本地目录加载技能,而不是从 GitHub URL 加载。克隆这个仓库,然后将文件复制到支持的技能位置之一。
选项A:个人技能(所有项目均可用)
选项B:项目技能(仅在一个仓库中提供)
在你项目的根目录中:
然后把.claude/skills/elasticsearch/目录提交到你的仓库,这样你的团队也能拿到。
验证
重启Claude代码,然后检查技能是否已加载:
你应该会在列表中看到elasticsearch。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Elasticsearch Skill for Claude Code
A markdown-based skill that teaches Claude Code how to interact with Elasticsearch clusters via REST API. No SDK, no client library, no MCP server — just curl and knowledge.
What’s in it
| File | What it covers |
|---|---|
SKILL.md |
Auth, search, CRUD, bulk ops, index management, cluster health, ILM, ES|QL, ingest pipelines |
references/query-dsl.md |
Full Query DSL — bool, match, term, range, nested, geo, wildcards, runtime fields, search_after |
references/aggregations.md |
Metric, bucket, and pipeline aggregations — plus SRE patterns (error rates, top-N leaderboards) |
Installation
Claude Code loads skills from local directories, not from GitHub URLs. Clone this repo, then copy the files to one of the supported skill locations.
Option A: Personal skill (available in all projects)
git clone https://github.com/davidgeorgehope/elasticsearch-skill.git
mkdir -p ~/.claude/skills/elasticsearch
cp elasticsearch-skill/SKILL.md ~/.claude/skills/elasticsearch/
cp -r elasticsearch-skill/references ~/.claude/skills/elasticsearch/
Option B: Project skill (available in one repo only)
From within your project’s root directory:
git clone https://github.com/davidgeorgehope/elasticsearch-skill.git /tmp/elasticsearch-skill
mkdir -p .claude/skills/elasticsearch
cp /tmp/elasticsearch-skill/SKILL.md .claude/skills/elasticsearch/
cp -r /tmp/elasticsearch-skill/references .claude/skills/elasticsearch/
Then commit the .claude/skills/elasticsearch/ directory to your repo so your team gets it too.
Verify
Restart Claude Code, then check the skill is loaded:
/skills
You should see elasticsearch in the list.
Note: Adding a GitHub URL to the
skillsarray in~/.claude/settings.jsondoes not work. Skills must be local files — there is no remote fetching.
Configuration
Set your cluster credentials as environment variables before starting Claude Code:
export ES_URL="https://your-cluster.es.cloud.elastic.co:443"
export ES_API_KEY="your-base64-api-key"
Optionally, for Kibana API access:
export KIBANA_URL="https://your-cluster.kb.cloud.elastic.co:443"
No server to run, no dependencies to install, no Docker container to spin up.
Why a Skill and Not MCP?
This is a deliberate choice, not a limitation.
The token tax
MCP servers expose tools via JSON schemas that get injected into the LLM’s context window on every request. Anthropic’s own testing found that a modest five-server setup with 58 tools consumed ~55,000 tokens before the conversation even started. That’s your context window being eaten alive by tool definitions you might not even use.
A skill loads its main instructions only when triggered, and deeper reference files only when the LLM actually needs them. Progressive disclosure by design — not by workaround.
The full circle
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add davidgeorgehope/elasticsearch-skill