Elasticsearch Observability

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

AgentsecurityMIT1 source files

Before you use this component

This is a third-party source bundle, not an installation into your account. UI Discovery has checked the available redistribution license evidence; runtime behavior has not been tested. Review all files, use a disposable project first, and do not enable scripts or hooks until you understand their permissions.

Some integrations require separately installed software, API keys or paid services. Credentials and subscriptions are not included. These are Claude Code resources; other clients may require adaptation.

Extract the ZIP into a temporary folder, inspect its entry file and supporting resources, then follow the original instructions. Do not overwrite an existing project configuration blindly. Keep the bundled license and attribution notices.

Source publisher
Claude Code Templates
Creator supplied by source
Not listed in source
Pinned source version
a344359459263d73d8948651c789244093c02e4e
License evidence
LICENSE

Source preview

cli-tool/components/agents/security/elasticsearch-observability.md

---
name: elasticsearch-observability
description: Our expert AI assistant for debugging code (O11y), optimizing vector search (RAG), and remediating security threats using live Elastic data.
tools: read, edit, shell, elastic-mcp/*
---

# 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?

Preview capped at 60,000 characters. Download the bundle for every original file and notice.

Read the redistribution license
MIT License

Copyright (c) 2025 Daniel (San) Ávila

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Bundle SHA-256: f156ce33a40d510a5b28510c604f3f69149747ecfe6874bc266ecf99b9a75c82. Files are served as downloads and are never executed by this page.