/elastic-elasticsearch:elasticsearch-anomaly-detectionfrom elastic-elasticsearch
Creates and manages Elasticsearch ML anomaly detection jobs via the REST API. Covers job setup, datafeed configuration, and lifecycle operations (open/start/stop).
Ships in elastic-elasticsearch. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Create, open, and start ML anomaly detection jobs on time-series data. Choose the right count-family detector direction, configure bucket span and time field, wire the datafeed to the correct index, and confirm running state from stats — not from assumptions.
This skill executes Elasticsearch operations through the elastic CLI. If the
elastic CLI is not installed, tell the user what it is needed for. Do
not guess credentials, call the HTTP API directly, or attempt other workarounds.
This skill references operations in HTTP-shorthand form (e.g., GET /, GET /_cat/indices, GET /{index}/_mapping,
GET /{index}/_settings/index.mode, POST /_query). The Operations table at the end of this document
maps each shorthand to the equivalent elastic CLI command — always use the CLI rather than calling the HTTP API
directly.
Prerequisite: ML anomaly detection requires a Platinum-equivalent license on self-managed clusters. Serverless projects include ML. The caller needs
manage_mlto create and manage jobs.Related skill: For interpreting anomaly scores, influencers, and model behavior after a job is running, use
elasticsearch-anomaly-detection-explainer— not this skill.
Discover the target index and time field. List candidate indices with GET /_cat/indices (pass a pattern when
the user names one). Fetch field types for the chosen index with GET /{index}/_mapping. The decision: confirm the
index exists, identify the time field (often @timestamp), and verify document volume is sufficient for baseline
learning. Never guess index or field names — they vary across deployments.
Choose detector function and direction. Match the user's intent to a count-family detector in
analysis_config.detectors:
high_count (or count, which flags both directions but is
acceptable when the user cares about spikes). Do not use low_count — it will miss spikes.low_count. Do not use high_count — it will miss drops
and silence.mean, high_mean, low_mean) with
field_name set — only when the user asks about a numeric metric, not raw event volume.The decision: pick one primary detector whose direction matches the anomaly type. For volume spike/drop questions on document counts, stay in the count family — mean detectors are unsuited to "how many events" questions.
Set immutable job shape before creation. These fields cannot change after PUT /_ml/anomaly_detectors/{job_id}:
analysis_config.bucket_span — use the interval the user specifies (e.g. 15m for 15-minute buckets). Match the
granularity of anomalies they care about; too short is noisy, too long is slow to detect.data_description.time_field — the time field from the mapping (commonly @timestamp).analysis_config.detectors — the function and direction from step 2.Example job body for a volume-spike detector:
{
"analysis_config": {
"bucket_span": "15m",
"detectors": [{ "function": "high_count" }]
},
"data_description": { "time_field": "@timestamp" }
}
Example for an outage / drop detector:
{
"analysis_config": {
"bucket_span": "15m",
"detectors": [{ "function": "low_count" }]
},
"data_description": { "time_field": "@timestamp" }
}
Create the job. Call PUT /_ml/anomaly_detectors/{job_id} with the job id the user requested (or a descriptive
id you propose). The job starts in closed state — creating it does not start analysis.
Create the datafeed. Call PUT /_ml/datafeeds/datafeed-{job_id} immediately after job creation. Set job_id to
the same id, indices to the target index (exact name or pattern from step 1), and a query that selects the relevant
documents (typically match_all). The datafeed id convention is datafeed-{job_id}.
{
"job_id": "{job_id}",
"indices": ["{index}"],
"query": { "match_all": {} }
}
Open the job, then start the datafeed — in that order. This sequence is mandatory; do not skip or reorder:
POST /_ml/anomaly_detectors/{job_id}/_open — transitions the job to opened.POST /_ml/datafeeds/datafeed-{job_id}/_start — transitions the datafeed to started.Opening before the datafeed exists fails. Starting the datafeed before opening the job fails. Do not report success after only creating resources — the job is not running until both are active.
Confirm running state from stats. Verify the outcome with:
GET /_ml/anomaly_detectors/{job_id}/_stats — expect state: "opened".GET /_ml/datafeeds/datafeed-{job_id}/_stats — expect state: "started".Optionally call GET /_ml/anomaly_detectors/{job_id} to confirm configuration (detectors, bucket_span,
time_field, datafeed indices). Report both stats states explicitly — "created" is not the same as "opened" and
"started".
When stopping or deleting a job, reverse the startup order:
POST /_ml/datafeeds/datafeed-{job_id}/_stop — stop the datafeed first.POST /_ml/anomaly_detectors/{job_id}/_close — then close the job.Stop the datafeed before closing the job. Close the job before resetting or deleting it.
bucket_span, detectors, time_field) require delete-and-recreate if wrong — validate mapping
and intent before the first PUT.indices at the exact index or pattern they named — not a
nearby guess.by_field_name, over_field_name, partition_field_name) and advanced tuning live in
references/anomaly-detection-reference.md.For API paths, request/response fields, score semantics, and field interactions, read references/anomaly-detection-reference.md.
| HTTP API (shorthand) | elastic CLI command |
|---|---|
GET /_cat/indices | elastic es cat indices --index '<pattern>' |
GET /{index}/_mapping | elastic es indices get-mapping --index '<index>' |
PUT /_ml/anomaly_detectors/{job_id} | elastic es ml put-job --job-id '<job_id>' --analysis-config '<json>' --data-description '<json>' |
PUT /_ml/datafeeds/datafeed-{job_id} | elastic es ml put-datafeed --datafeed-id 'datafeed-<job_id>' --job-id '<job_id>' --indices '<index>' --query '<json>' |
POST /_ml/anomaly_detectors/{job_id}/_open | elastic es ml open-job --job-id '<job_id>' |
POST /_ml/datafeeds/datafeed-{job_id}/_start | elastic es ml start-datafeed --datafeed-id 'datafeed-<job_id>' |
GET /_ml/anomaly_detectors/{job_id} | elastic es ml get-jobs --job-id '<job_id>' |
GET /_ml/anomaly_detectors/{job_id}/_stats | elastic es ml get-job-stats --job-id '<job_id>' |
GET /_ml/datafeeds/datafeed-{job_id}/_stats | elastic es ml get-datafeed-stats --datafeed-id 'datafeed-<job_id>' |
POST /_ml/datafeeds/datafeed-{job_id}/_stop | elastic es ml stop-datafeed --datafeed-id 'datafeed-<job_id>' |
POST /_ml/anomaly_detectors/{job_id}/_close | elastic es ml close-job --job-id '<job_id>' |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub elastic/agent-skills --plugin elastic-elasticsearch10 skills in this plugin
/elasticsearch-anomaly-detection-explainerExplain Elasticsearch ML anomaly detection scores, model behavior, and result interpretation. Use when the user asks why a score is high or low, how the model learns, what the numbers mean, or how to troubleshoot unexpected anomaly scores.
/elasticsearch-cluster-healthDiagnose a non-green Elasticsearch cluster and surface the single most likely cause with remediation. Use when an operator reports yellow or red status, unassigned shards, allocation failures, or wants read-only triage before deeper investigation. Teaches replica-vs-primary impact, allocation decider classification, and data-loss awareness.
/elasticsearch-esqlExecute ES|QL (Elasticsearch Query Language) queries, use when the user wants to query Elasticsearch data, analyze logs, aggregate metrics, explore data, or create charts and dashboards from ES|QL results.
/elasticsearch-index-designDesign and review Elasticsearch index mappings for stated access patterns: correct field types, text+keyword multi-fields, doc_values tuning, mapping-explosion avoidance, and explicit shard settings. Use when creating a new index, reviewing a mapping for storage or query performance, fixing wrong field types, or when the user asks which type to use for search, filter, sort, or aggregation on a field.
/elasticsearch-ingestLoad local CSV, JSON array, and NDJSON files into Elasticsearch indices with the bulk API through the `elastic` CLI, creating an explicit mapping first when field types matter. Use when batch-importing local files, loading a pre-formed bulk NDJSON body, or verifying document counts and mappings after a load — not for Logstash pipelines, Beats, Elastic Agent, continuous ingestion, or index-to-index reindex.
/elasticsearch-onboardingHelp developers new to Elasticsearch get from zero to a working search experience. Guide them through understanding their intent, mapping their data, and building a search experience with best practices baked in. Use this when the user shows intent to build search-related functionality, asks about Elasticsearch-related concepts for their use case, or expresses the need for help getting started with Elasticsearch. Also use this when the user wants to search, monitor, or analyze logs, metrics, or security events, so they can be redirected to Elastic's Observability or Security solution.
2 plugins ship this exact skill · first indexed Sep 6, 2026
Other plugins' skills for the same job