MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Elasticsearch-Agent

Elasticsearch-Agent是一款data方向的AI技能,核心价值是Our expert AI assistant for debugging code (O11y), optimizing vector search (RAG), and remediating security threats using live Elastic data,可用于解决开发者在data领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Our expert AI assistant for debugging code (O11y), optimizing vector search (RAG), and remediating security threats using live Elastic data.

Last verified on: 2026-05-30
mkdir -p ./skills/elasticsearch-observability && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/elasticsearch-observability/SKILL.md -o ./skills/elasticsearch-observability/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# !! ACTION REQUIRED !!

# Replace this URL with your actual Kibana URL

# ---

'https://{KIBANA_URL}/api/agent_builder/mcp',

'--header',

'Authorization:${AUTH_HEADER}'

]

# This section maps a GitHub secret to the AUTH_HEADER environment variable

# The 'ApiKey' prefix is required by Elastic

env:

AUTH_HEADER: ApiKey ${{ secrets.ELASTIC_API_KEY }}

---


# System


You are the Elastic AI Assistant, a generative AI agent built on the Elasticsearch Relevance Engine (ESRE).


Your primary expertise is in helping developers, SREs, and security analysts write and optimize code by leveraging the real-time and historical data stored in Elastic. This includes:

- **Observability:** Logs, metrics, APM traces.

- **Security:** SIEM alerts, endpoint data.

- **Search & Vector:** Full-text search, semantic vector search, and hybrid RAG implementations.


You are an expert in **ES|QL** (Elasticsearch Query Language) and can both generate and optimize ES|QL queries. When a developer provides you with an error, a code snippet, or a performance problem, your goal is to:

1. Ask for the relevant context from their Elastic data (logs, traces, etc.).

2. Correlate this data to identify the root cause.

3. Suggest specific code-level optimizations, fixes, or remediation steps.

4. Provide optimized queries or index/mapping suggestions for performance tuning, especially for vector search.


---


# User


Observability & Code-Level Debugging


Prompt

My `checkout-service` (in Java) is throwing `HTTP 503` errors. Correlate its logs, metrics (CPU, memory), and APM traces to find the root cause.


Prompt

I'm seeing `javax.persistence.OptimisticLockException` in my Spring Boot service logs. Analyze the traces for the request `POST /api/v1/update_item` and suggest a code change (e.g., in Java) to handle this concurrency issue.


Prompt

An 'OOMKilled' event was detected on my 'payment-processor' pod. Analyze the associated JVM metrics (heap, GC) and logs from that container, then generate a report on the potential memory leak and suggest remediation steps.


Prompt

Generate an ES|QL query to find the P95 latency for all traces tagged with `http.method: "POST"` and `service.name: "api-gateway"` that also have an error.


Search, Vector & Performance Optimization


Prompt

I have a slow ES|QL query: `[...query...]`. Analyze it and suggest a rewrite or a new index mapping for my 'production-logs' index to improve its performance.


Prompt

I am building a RAG application. Show me the best way to create an Elasticsearch index mapping for storing 768-dim embedding vectors using `HNSW` for efficient kNN search.


Prompt

Show me the Python code to perform a hybrid search on my 'doc-index'. It should combine a BM25 full-text search for `query_text` with a kNN vector search for `query_vector`, and use RRF to combine the scores.


Prompt

My vector search recall is low. Based on my index mapping, what `HNSW` parameters (like `m` and `ef_construction`) should I tune, and what are the trade-offs?


Security & Remediation


Prompt

Elastic Security generated an alert: "Anomalous Network Activity Detected" for `user_id: 'alice'`. Summarize the associated logs and endpoint data. Is this a false positive or a real threat, and what are the recommended remediation steps?

🎯 Best For

  • Security auditors
  • DevSecOps teams
  • Compliance officers
  • Debugging engineers
  • QA teams

💡 Use Cases

  • Auditing dependencies for known CVEs
  • Scanning API endpoints for auth gaps
  • Tracing runtime errors in production logs
  • Identifying memory leaks

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Elasticsearch-Agent to Your Work

    Provide context for your task — paste source material, describe your audience, or share existing work to guide the AI.

  4. 4

    Review and Refine

    Edit the AI output for accuracy, tone, and completeness. Add human insight where the AI lacks context.

❓ Frequently Asked Questions

Can this replace a dedicated SAST tool?

AI-based security review is complementary to SAST tools. Use it as a first-pass filter, not a replacement.

Can this debug production issues?

Yes, but always ensure you have proper logging and monitoring in place first.

How do I install Elasticsearch-Agent?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/elasticsearch-observability/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Only scanning surface-level issues

Deep security review requires understanding your app architecture, not just regex patterns.

Debugging without context

Always provide the full error stack and surrounding code context for accurate debugging.

Ignoring data quality

AI analysis inherits all data quality issues — profile your data first.

🔗 Related Skills