mit einem Klick
elasticsearch-esql
// Use this skill when writing or debugging ES|QL queries for Elasticsearch. Activate when the user asks to query logs, metrics, traces, or any Elasticsearch data using ES|QL syntax.
// Use this skill when writing or debugging ES|QL queries for Elasticsearch. Activate when the user asks to query logs, metrics, traces, or any Elasticsearch data using ES|QL syntax.
Use when invoking the elastic CLI via elastic_cli or choosing CLI vs MCP/native Kibana tools. Covers shorthands, serverless gotchas, command names, and docs/ESQL flags.
Use this skill when performing root cause analysis on incidents detected by Elastic Observability. Activate when the user reports a production issue, outage, degraded performance, or asks to investigate alerts.
Use this skill when working with Elastic SLOs (Service Level Objectives). Activate when the user asks about SLO status, burn rates, error budgets, or needs to create and manage SLO definitions.
| name | elasticsearch-esql |
| description | Use this skill when writing or debugging ES|QL queries for Elasticsearch. Activate when the user asks to query logs, metrics, traces, or any Elasticsearch data using ES|QL syntax. |
| metadata | {"version":"0.1.0","visibility":"public"} |
ES|QL (Elasticsearch Query Language) is a piped query language for filtering, transforming, and aggregating Elasticsearch data.
FROM <index-pattern>
| WHERE <condition>
| STATS <aggregation> BY <field>
| SORT <field> [ASC|DESC]
| LIMIT <n>
Use the elastic CLI:
elastic es query 'FROM logs-* | WHERE @timestamp > NOW() - 1 HOUR | LIMIT 10'
Filter by time range:
FROM logs-*
| WHERE @timestamp > NOW() - 24 HOURS
Count by field:
FROM logs-*
| STATS count = COUNT(*) BY service.name
| SORT count DESC
Percentiles:
FROM metrics-apm*
| STATS p50 = PERCENTILE(transaction.duration.us, 50),
p95 = PERCENTILE(transaction.duration.us, 95),
p99 = PERCENTILE(transaction.duration.us, 99)
BY service.name
Time bucketing:
FROM logs-*
| WHERE log.level == "error"
| STATS errors = COUNT(*) BY bucket = BUCKET(@timestamp, 5 minute)
| SORT bucket
Multi-field filtering:
FROM logs-*
| WHERE service.name == "api-gateway" AND http.response.status_code >= 500
| KEEP @timestamp, message, http.response.status_code, trace.id
| SORT @timestamp DESC
| LIMIT 50
TO_STRING(field), TO_INTEGER(field), TO_DOUBLE(field) -- type conversionsDATE_TRUNC(interval, field) -- truncate timestampsCONCAT(a, b) -- string concatenationLENGTH(field) -- string lengthTRIM(field), LEFT(field, n), RIGHT(field, n) -- string manipulationCOUNT(*), COUNT(field), COUNT_DISTINCT(field)SUM(field), AVG(field), MIN(field), MAX(field)PERCENTILE(field, pct), MEDIAN(field)VALUES(field) -- collect distinct valuesWHERE @timestamp > NOW() - <duration> to avoid scanning too much dataLIMIT to control output sizeKEEP to select specific columns before outputDROP to exclude columnsRENAME old AS new to rename columnsEVAL new_field = expression to create computed columnsDISSECT or GROK for parsing unstructured text fields