What Is Anomaly Detection (Machine Learning Jobs) in Elasticsearch?

What Is Anomaly Detection (Machine Learning Jobs) in Elasticsearch?

A complete, step-by-step guide to how Elasticsearch learns what "normal" looks like in your data, spots the strange moments no fixed alert would catch, and does it at production scale.

It is 3:07 in the morning. Nobody in your company is awake. Deep inside your online shop, something small is changing: pages that normally load in a quarter of a second now take a full second. No error message appears. No alarm rings. Your only alert is set to fire at five seconds, so it stays silent. By nine o’clock, thousands of shoppers have quietly given up and left.

Elasticsearch anomaly detection was built for exactly this kind of moment. Instead of waiting for you to guess the right number to watch, it studies your data, learns the usual rhythm, and taps you on the shoulder when something stops fitting that rhythm. This article explains every piece of it in plain language: what it is, how it thinks, how to set it up, how to read its answers, and how to run it safely when your data grows very large.

WWhat Is Anomaly Detection in Elasticsearch?

Start here. By the end of this chapter you will know what an anomaly is, what a “machine learning job” is, and where this feature came from.

Anomaly detection in Elasticsearch is a built-in machine learning feature that automatically learns what “normal” looks like in your time-based data and then flags anything that does not fit. An anomaly is simply a moment or a pattern that is unusual compared with what came before. A sudden jump in errors is an anomaly. So is a sudden drop in sales, a user who logs in from a country they have never used, or a server that suddenly sends ten times more data than its neighbors.

The feature works on time series data. That is a fancy name for records that each carry a timestamp: web server logs, CPU readings, payment transactions, temperature sensors, security events. If your data has a “when” attached to every row, anomaly detection can watch it.

What does “machine learning job” mean?

Elasticsearch organizes this work into jobs. A job is a saved set of instructions that says, in effect, “watch this data, ask this question, and remember what you learn.” You create one job for each kind of question you want answered. For example, one job might watch how long web pages take to load, and another might watch how many failed logins each user has.

In the Kibana screens you will find them under Machine Learning, then Anomaly Detection, then Jobs. You may also hear the words “ML jobs” used loosely. Elasticsearch has other machine learning tools too, such as data frame analytics jobs that can find odd rows in a static table, but this article is about anomaly detection jobs, the ones that watch data flowing through time.

Why is it called unsupervised?

Many machine learning systems need a teacher. You show them thousands of examples labeled “good” and “bad,” and they learn to copy your labels. Anomaly detection in Elasticsearch needs no teacher at all. Nobody has to tag a single record. The job studies the data on its own, decides what is typical, and measures how far each new moment strays from typical. This is called unsupervised learning, and it is what makes the feature practical: nobody has the time to label a year of server history.

Everyday analogy

Picture a night guard who has worked at the same apartment building for years. Nobody wrote him a rulebook. He simply knows that the baker leaves at 4 a.m., the delivery van arrives on Tuesdays, and the third-floor lights are always off by midnight. One night a stranger tries a door handle at 2 a.m. and the guard notices at once, even though “stranger at 2 a.m.” was never written down anywhere. Anomaly detection is that guard, working for your data.

0 to 100
the score every anomaly receives, where higher means stranger
Zero labels
needed from you before the job starts learning
About 3 weeks
of history helps the job learn weekly rhythms well

A short history

Elastic, the company behind Elasticsearch, bought a specialist anomaly detection company called Prelert in 2016. Prelert had spent years perfecting statistical techniques for spotting strange behavior in IT data. Elastic folded that engine into its stack, and it first shipped to customers in 2017 as part of a commercial add-on called X-Pack. In the following years the add-on’s code was bundled into the standard download, and the machine learning family grew: new job types were added, data frame analytics arrived for finding outliers in static data sets, and the feature became woven into Elastic’s security and observability products.

Today anomaly detection is a first-class citizen of the platform. It has its own screens in Kibana, its own programming interfaces, its own dedicated processes, and ready-made jobs for common needs such as unusual logins or slow application services. Like most advanced features in the stack, it requires a paid subscription tier (or a trial) rather than the free basic license, so check your license before you plan a project around it.

i
Word check

Whenever you see the word “normal” in this article, read it as “the pattern your data usually follows, including its regular ups and downs.” A busy Friday evening can be perfectly normal for a food-delivery app. The job learns that on its own.

TThe Problem: Why Fixed Rules Fall Short

To understand why anomaly detection exists, first see why the older approach, fixed alert rules, keeps letting people down.

The classic way to watch a system is to pick a number and draw a line. “Alert me if response time goes above two seconds.” “Alert me if errors go above fifty per minute.” These static thresholds are easy to understand, and they are still useful for hard limits such as a disk that is completely full. But as a general watching method they fail in four predictable ways.

Failure one: the world has a rhythm

Real traffic is not flat. A shop that serves 2,000 requests per minute at lunchtime may serve only 40 at three in the morning. If you set the threshold at 1,000 to catch daytime trouble, then a night-time explosion from 40 to 400 requests, ten times more than usual and very possibly an attack, slips right under the line. If you lower the threshold to 100 to catch the night trouble, it fires all day long for perfectly healthy traffic. No single number can be right at every hour.

Everyday analogy

A fixed threshold is like a speed limit sign that says 50 for every road, every hour, every kind of weather. It is fine on a dry afternoon highway. It is far too fast outside a school at pick-up time, and far too slow on an empty motorway at dawn. A wise driver instead knows what is normal for this road right now.

Failure two: there are too many things to watch

A company with 10,000 servers, each reporting 20 different measurements, has 200,000 separate streams of numbers. Nobody can hand-write and hand-tune 200,000 rules, and every new server or new service adds more. Anomaly detection lets one job watch every server, learning a separate normal for each one.

Failure three: normal keeps changing

Businesses grow. A threshold that was perfect in January is too low by June because customers doubled. Somebody has to remember to update it, and somebody always forgets. Learned models adapt as the data changes, so the definition of normal moves along with the business.

Failure four: you cannot alert on what you never imagined

Every threshold is a guess about what might go wrong. The most expensive incidents are often the ones nobody imagined: a cache that quietly stops working, a partner whose requests suddenly triple, a login pattern that looks like a slow, careful thief. Because anomaly detection compares the data with its own history rather than with your guesses, it can notice trouble you never thought to ask about.

Example: the quiet slowdown

A large streaming service such as Netflix serves video to many millions of viewers. Imagine that a small fraction of viewers in one region begin waiting a little longer for videos to start. The overall average barely moves, so a global threshold stays quiet. A job that learns normal start-up time for each region separately would notice the change within minutes.

Example: the unusual customer

A payments company such as PayPal handles millions of transactions per day. One account that normally sends three small payments a week suddenly sends two hundred. No fixed rule mentions this account, but a model of that account’s own history sees the difference immediately.

QuestionFixed thresholdAnomaly detection job
Who decides what is normal?A person, by guessing a numberThe model, by studying your real history
Handles daily and weekly rhythm?No, one number for all hoursYes, it learns hourly and weekly patterns
Handles thousands of series?Poorly, one rule per seriesWell, one job can model many series
Adapts as the business grows?Only when someone edits itAutomatically, it keeps learning
Best atHard limits and known dangersUnknown dangers and gradual change
A threshold answers the question you already thought to ask. Anomaly detection also answers the ones you did not.

None of this means thresholds are useless. A disk that is 99 percent full deserves an alert no matter what history says. The best monitoring setups use both: thresholds for hard limits, and learned models for everything that has a rhythm.

CCore Concepts: The Vocabulary You Need

Eight words unlock the whole feature. Each one is explained with what it is, why it exists, where you meet it, and a picture from everyday life.

The job

A job is the saved question. It records which field holds the timestamp, how often to summarize the data, which measurements to study, and how much memory the learning may use. You meet it in the Jobs list in Kibana, where each job shows its state, its data, and its latest results. Think of a job as a night-shift worker with a written assignment card: “Watch the checkout page and tell me if it acts strangely.”

The datafeed

The datafeed is the delivery route that brings data from your Elasticsearch indices to the job. It runs a search on a schedule, collects the matching documents, and hands them to the learning engine. A datafeed can also apply a filter so that only the data you care about, say, requests to one website, is delivered. If the job is the worker, the datafeed is the conveyor belt carrying items to the worker’s desk.

The bucket span

The job does not judge every single record one by one. It sorts time into equal slices called buckets and judges each slice as a whole. The length of a slice is the bucket span, for example fifteen minutes. In each bucket the job might count events or average a measurement, and then ask “is this bucket normal?” A bucket is like an hourly report card for a school: not every heartbeat of the day is graded, only the summary of each period.

The detector

A detector is one precise question inside a job. It pairs a function (what to calculate, such as count, average, or maximum) with optional fields (what to calculate it over and how to split it). “Count the events” is a detector. “Average the response time, separately for each server” is another. One job can hold several detectors, like a worker who has several checklist items.

The model

The model is everything the job has learned so far: typical levels, daily and weekly cycles, long-term trends, and how much natural wobble to expect. It lives inside a dedicated native process and is saved periodically so it survives restarts. The model is the guard’s memory of how the building behaves.

The anomaly score

For every bucket and record, the job produces an anomaly score from 0 to 100. It tells you how surprising the moment was, on a scale that is adjusted to your own data. A score near 0 means “completely ordinary.” A score near 100 means “among the most unusual things this job has ever seen.” Kibana turns scores into four colored bands: warning, minor, major and critical.

The influencer

Knowing that something is odd is half the story. The other half is who or what was involved. Influencers are fields, such as host name, user name or country, that you list so the job can point at the entities that seem to have contributed most to an anomaly. It is like a detective asking not only “was the milk spilled?” but “which of these children was standing next to it?” Influencers are clues, not proof of guilt.

The results

Results are what the job writes down: a score for every bucket, a detailed record for every anomaly, and influencer rankings. They are stored in special system indices inside Elasticsearch, so you can search them, chart them, and alert on them just like any other data. Results are the guard’s logbook.

Question

Job

The saved assignment: what to watch, how to summarize it, and how much memory to use.

Delivery

Datafeed

The route that carries matching documents from your indices into the job.

Time slice

Bucket span

The length of each time slice that gets its own verdict, such as 15 minutes.

Precise ask

Detector

One function plus optional fields, like “average response time per server.”

Memory

Model

Everything learned about normal behavior, saved so it survives restarts.

Verdict

Anomaly score

A 0 to 100 measure of how surprising a moment was for your own data.

Clue

Influencer

A field whose values seem to have contributed to an anomaly.

Logbook

Results

Scores, records and influencer rankings stored as searchable data.

i
Remember

Job, datafeed, model, results. If you keep only four words in your head, keep these. Data goes in through the datafeed, the job learns a model, and the results come out as searchable scores.

AArchitecture and Components

Now let us zoom out and see the machinery: which parts exist, where each one runs, and how they talk to each other.

Anomaly detection is not a plugin bolted on the side of Elasticsearch. It is woven into the cluster. Your data stays in your own indices, the learning happens on your own machines, and the answers come back into your own indices. Nothing leaves the cluster. The diagram below shows the full path from raw data to a notification in somebody’s chat window.

flowchart LR
    SRC["Source indices - logs, metrics, events"] --> DF["Datafeed"]
    CFG["Job configuration - system index"] --> AP
    DF --> AP["Native analysis process - one per open job"]
    AP --> RES["Results index - scores, records, influencers"]
    AP --> SNAP["Model snapshots - saved memory of the model"]
    RES --> KB["Kibana - Anomaly Explorer and Single Metric Viewer"]
    RES --> RULE["Alerting rules"]
    RULE --> OUT["Email, chat, tickets, webhooks"]
    subgraph MLNODE["Machine learning node"]
        DF
        AP
    end
Figure 1. Data flows from source indices, through a datafeed, into a native analysis process, and out as searchable results.

Walking through the diagram

On the far left are your source indices, the ordinary Elasticsearch indices that already hold your logs, metrics or business events. The datafeed reads from them. The job configuration, kept safely in an internal system index, tells the analysis process what to compute. The native analysis process is the brain: a separate program written in C++ that runs beside Elasticsearch, one copy for each open job. It receives the summarized data, updates the model, and decides how surprising each bucket was.

It writes two kinds of output. The first is results, which land in a results index. Kibana reads these to draw its charts, and alerting rules read them to decide when to notify a human. The second is model snapshots, periodic saves of everything the model has learned, so that a restart never means starting the education from zero.

Everyday analogy

Think of a mail-sorting center. Letters arrive from many post offices (source indices). A truck driver (the datafeed) carries a bundle to a specialist clerk (the native process) who has an instruction sheet (the job configuration). The clerk stamps each bundle with a rating and files the paperwork in a cabinet (results), and every few hours photographs the whole sorting table (a snapshot) in case the building has to be evacuated.

The components in detail

ComponentWhat it doesWhere it lives
Kibana machine learning screensWizards to create jobs, plus viewers to explore resultsKibana, talking to Elasticsearch through APIs
Machine learning APIsCreate, open, close, start, stop, forecast and inspect jobsElasticsearch, under its machine learning endpoints
Machine learning nodesThe machines allowed to run jobs; they carry a special node roleYour cluster, ideally dedicated to this work
DatafeedRuns searches and streams matching data to the jobOn the same node as its job
Native analysis processBuilds the model, scores buckets, writes resultsOutside the Java memory of Elasticsearch, on the machine learning node
System indicesStore job configuration, model state, results and notificationsRegular data nodes, hidden from ordinary index lists
Alerting rulesWatch results and trigger notificationsKibana alerting framework

Who decides where a job runs?

When you open a job, the cluster’s master node picks a machine learning node with enough spare memory and assigns the job to it. This uses the same “persistent task” idea that Elasticsearch uses for other long-running background work. If that node later disappears, the master notices and reassigns the job elsewhere. Think of a control tower at an airport assigning planes to gates: it always knows which gates are free and moves planes when a gate closes.

!
Tip

Because the analysis process uses memory outside the normal Java heap, machine learning nodes need to be sized with that in mind. In production, give the work its own dedicated nodes so that a hungry job can never slow down the searches your customers are running.

IInternal Working: How the Job Actually Learns

This is the engine room. You do not need a mathematics degree to follow it, because every idea comes with a picture.

Under the hood, the analysis process repeats a simple loop for every bucket of time. It receives the summary of the bucket, compares it with what the model expected, works out how unlikely the difference is, turns that unlikeliness into a score, and then learns from the new data so that tomorrow’s expectations are a little smarter.

flowchart TD
    A["New bucket of data arrives"] --> B["Summarize it - for example count or average"]
    B --> C["Model predicts what was expected"]
    C --> D["Compare actual with expected"]
    D --> E["Work out the probability of seeing this"]
    E --> F["Convert probability to a score from 0 to 100"]
    F --> G["Write results for Kibana and alerts"]
    D --> H["Update the model with the new value"]
    H --> C
Figure 2. The learning loop that runs for every bucket. Prediction and learning happen together, forever.

Step one: summarize

Raw records are far too numerous and noisy to judge one at a time, so the job first squeezes each bucket into a small number that matches the detector’s function. If the detector is “count,” the number is how many events happened in the bucket. If it is “mean of response time,” the number is the average. This is why picking the right bucket span matters: it sets how much detail survives the squeeze.

Step two: predict

The model holds a picture of how this number usually behaves. Elastic describes the machinery as a blend of statistical techniques. One breaks the history into layers: a long-term trend (are we growing?), repeating cycles such as day and week, and leftover random noise. Another describes how likely each possible value is, using Bayesian probability. Others group similar entities together and notice when measurements move together. Combined, they let the model say, “at 10 a.m. on a Tuesday for this server, I expect around 1,900 requests, give or take 150.”

Everyday analogy

Listen to a piece of music you know well. You can hum along because you know the melody (the trend), the beat that repeats every few seconds (the cycles), and you accept the small variations each performer adds (the noise). If the drummer suddenly plays the wrong song, you notice immediately. The model hums along with your data in exactly this way.

Step three: measure surprise as a probability

Now the job looks at the real number, say 5,400 requests, and asks: “If my model is right, how likely is a value this far away?” The answer is a probability, often a tiny one such as one in a million. The smaller the probability, the stranger the moment. The probability of each bucket is stored in the results as well, so you can inspect it later if you are curious.

Step four: normalize into a score

Tiny probabilities are hard for humans to read, so the job translates them to the friendly 0 to 100 scale. It does this by comparing each surprise with the most surprising moments seen so far in that job. This is called normalization. Because it is relative to your own history, “90” means the same kind of rare event in a quiet system as in a wild one. A side effect is that scores can be revised: if something even stranger happens later, earlier scores may be nudged down, because the yardstick has stretched. The results keep both the first-draft score and the current one.

Step five: learn

Finally the new value is folded into the model. This is online learning: the model updates continuously as data arrives, with no separate training phase and no nightly retraining schedule. It also means the model keeps adapting to change. If your traffic permanently doubles after a marketing campaign, the model gradually accepts the new level as normal.

Anomalies that build slowly

Not every problem is a spike. A slow memory leak might push a measurement up by only a small step every bucket. Each single step is unremarkable, but the sum is alarming. The job therefore also looks at groups of neighboring buckets, roughly a dozen at a time, and can report a multi-bucket anomaly when the combined deviation is unlikely even though no single bucket was. Results carry a field that shows how much the multi-bucket view contributed. A sudden blowout of a tire is easy to spot; a slow leak needs you to compare the pressure now with the pressure an hour ago.

The early learning period

A new job knows nothing, so it starts humble. In its first buckets it has little evidence and its predictions are rough, so early results can be noisy. As a rule of thumb, a few hundred buckets give a decent picture of ordinary behavior, and if your data has weekly rhythms, about three weeks of history helps the model learn them properly. This is why it is common to start a job by feeding it historical data first, a step described in the next chapter.

1

Bucket closes

The job summarizes the time slice into one number per series.

2

Model predicts

Trend, cycles and typical wobble produce an expected value with a normal range.

3

Probability is computed

The distance between actual and expected becomes a tiny number if the moment is rare.

4

Score is normalized

The probability becomes a 0 to 100 score relative to the strangest moments seen so far.

5

Results and learning

Results are written for humans and alerts, and the model absorbs the new value.

A worked example with real numbers

Suppose a job counts requests to an online store in five-minute buckets. From weeks of history, the model has learned that on Tuesday mornings around ten o’clock the count is usually near 1,900, and that the natural wobble is about 150 either way. Now consider three possible buckets. In the first, 1,950 requests arrive. That is well inside the usual wobble, its probability is high, and the score stays near zero. In the second, 2,300 arrive. That is a little unusual, perhaps a small campaign, and the score is low but visible. In the third, 5,400 arrive. That is far outside anything the model has seen at this hour, its probability is minuscule, and the score climbs toward the top of the scale. The exact mathematics is richer than a simple bell curve, but this picture gets the intuition right: the further outside your usual range, and the rarer that distance, the higher the score.

Now imagine the same 5,400 arriving on a Saturday night during a big televised event when the model has seen similar surges many times before. The score would be much lower, because the model has learned that such nights are busy. The same number can be alarming on one occasion and ordinary on another. That is precisely the power of learning context rather than comparing against a fixed line.

Memory management inside the process

Every entity the job models, each server, each user, each country, costs a little memory. The job has a configured limit, and it watches its own usage. When usage approaches the limit it first tries to forget the least useful models, such as those for entities that have not been seen for a while. If it truly reaches the limit, it stops creating models for new entities, and some data is dropped rather than analyzed. The job reports which of these states it is in, and you will meet that report again in the monitoring chapter. Consider it a backpack: you can carry many things, but eventually you must decide what stays.

DData Flow and Lifecycle

A job is born, opened, fed, watched, stopped and eventually retired. Knowing each stage prevents most beginner surprises.

Two switches, not one

Beginners often assume a job is a single on-off switch. It is actually two things. The job can be open or closed, which decides whether its analysis process is running and holding a model in memory. The datafeed can be started or stopped, which decides whether data is flowing in. A job must be open before its datafeed can deliver anything. Picture a factory: opening the job turns on the machine, starting the datafeed turns on the conveyor belt.

stateDiagram-v2
    [*] --> closed
    closed --> opening : open job
    opening --> opened : process ready
    opened --> closing : close job
    closing --> closed : model saved
    opened --> failed : unrecoverable error
    failed --> closed : force close
    closed --> [*] : delete job
Figure 3. The life of a job. A failed job must be force-closed before it can be reopened.

Historical lookback, then real time

You can start a datafeed at a chosen time in the past. The datafeed then races through old data as fast as the machine allows. This is the lookback phase, and it teaches the model about your normal patterns in minutes instead of weeks. Thirty days of history at fifteen-minute buckets is 2,880 buckets, plenty for a solid first impression. When the datafeed catches up with the present and you did not give it an end time, it flips into real-time mode and keeps polling for fresh data forever, or until you stop it.

1

Create

You describe the job and its datafeed, often through a Kibana wizard that previews the data first.

2

Open

The cluster assigns the job to a machine learning node and starts its native process.

3

Start the datafeed with a past start time

Historical data streams in quickly and the model learns your usual rhythms.

4

Run in real time

The datafeed polls for new documents and results appear within moments of each bucket closing.

5

Stop and close

When you stop the datafeed and close the job, the model is saved so it can resume later.

6

Delete

Removing the job deletes its results and snapshots, so export anything you want to keep.

Frequency and query delay

In real-time mode two timing settings matter. The frequency is how often the datafeed knocks on the door of your indices to ask for fresh data. The query delay is how far behind “now” it looks, and it is deliberately not zero. Real systems are messy: an event that happened at 10:00:02 may only arrive in Elasticsearch at 10:00:40 because of network hops and ingest pipelines. If the datafeed asked for data up to exactly 10:00:00 at exactly 10:00:00, it would miss such late arrivals forever. The default delay is around a minute or two, and you should raise it if your data reaches Elasticsearch slowly.

!
Watch out: delayed data

If documents are indexed later than the query delay allows, the job never sees them, and it may report a smaller-than-real number for that bucket. Elasticsearch can check for this and warn you. When you see a “missed documents” warning, increase the query delay or fix the slow part of your ingest path.

Summarized datafeeds for huge data

If your source generates millions of documents per minute, dragging every raw document across to the job wastes effort. A datafeed can instead ask Elasticsearch to do the counting and averaging first using aggregations, so only a tiny summary travels. This is called an aggregated datafeed. The trade-off is that you must design the aggregation carefully, because the job now trusts whatever summary it is given.

Where the results go

Every result is written to the results indices as it is produced. Notifications about the job itself, such as “job opened” or “memory limit reached,” are written to a separate notifications index. Both can be searched with the tools you already know.

YYour First Job: A Guided Tour

Before we go deeper, here is what actually happens on the screen when you create a job. Knowing the route makes the later chapters easier to follow.

Creating a job in Kibana feels like filling in a well-designed form with a live preview. You do not write instructions in a special language. You choose, look at a chart, adjust, and confirm. Here is the journey, step by step, for a beginner who wants to watch the response time of a web application.

Before you begin

Two things must be in place. First, your license or trial must include the feature, and your cluster must have at least one machine learning node. Second, your data must already be in Elasticsearch with a timestamp field, and Kibana must have a data view for it. A data view is simply Kibana’s saved description of which indices to read and which field holds the time. If you can already see your data in Discover, you are ready.

Explore the data first

Kibana includes a Data Visualizer, a screen that profiles a data view. It shows every field, how many different values each one has, and what the typical values look like. This is the perfect moment to check the cardinality of a field you plan to split by. Discovering that a field has ten values is good news. Discovering it has ten million saves you from a costly mistake. Think of it as walking around a house before you start decorating.

1

Open the job creation screen

Go to the Machine Learning area of Kibana, choose Anomaly Detection, and start a new job. Pick your data view.

2

Choose a wizard

Single metric, multi-metric, population, categorization, rare, geographic, or advanced. A beginner should start with single or multi-metric.

3

Pick the time range

A button lets you use the full range of your data. More history means a better first education for the model.

4

Choose the measurement

Select the function, such as average of response time. Optionally choose a split field and the influencers.

5

Set the bucket span

Ask Kibana to estimate a span based on your data, then accept it or adjust it. The chart on screen updates to preview how your data looks at that span.

6

Check memory and name the job

Accept the estimated model memory limit, give the job an identifier, and optionally add it to a group.

7

Validate

Kibana checks your choices and warns about problems, such as a bucket span far shorter than your data’s frequency or a field with too many distinct values.

8

Create and start

Choose whether to run over the full history and then continue in real time. Watch the chart fill in as the job learns.

What you will see in the first minutes

As the historical data flows through, Kibana shows a progress bar and starts drawing the model’s expected band around your line. Anomalies appear as colored dots. In the early stretch the band may look wide and jumpy, because the model is still forming an opinion. As time passes the band tightens and follows your daily rhythm closely. This is the model growing confident. When the run finishes, you can open the Single Metric Viewer or the Anomaly Explorer and start reading results.

Everyday analogy

The first run is like giving a new employee a month of old shift reports to read on their first day. By the time they start real work, they have already seen enough Mondays and Fridays to recognize a strange one. You could instead let them learn only from live days, but then you would wait a month for them to become useful.

!
Tip

Do not worry about getting the first job perfect. Jobs can be cloned, and settings such as bucket span are easy to reconsider after you see real results. The first job is a lesson in your own data.

JJob Types: Choosing the Right Tool

Kibana offers several job wizards, each shaped for a different kind of question. Picking the right one saves hours of tuning.

All job types share the same engine. What differs is how much the wizard configures for you and what kind of question it is designed to answer. The decision chart below is a quick way to choose. Start at the top and follow the question that sounds most like yours.

flowchart TD
    Q["What do you want to watch?"] --> A{"One number over time?"}
    A -->|"Yes"| SM["Single metric job"]
    Q --> M{"Several numbers, or one number split by a field?"}
    M -->|"Yes"| MM["Multi-metric job"]
    Q --> B{"Compare many entities with each other?"}
    B -->|"Yes"| POP["Population job"]
    Q --> C{"Free-text log messages?"}
    C -->|"Yes"| CAT["Categorization job"]
    Q --> D{"Unusual values or places?"}
    D -->|"Values seen rarely"| RARE["Rare job"]
    D -->|"Locations on a map"| GEO["Geographic job"]
    Q --> E{"Need every setting under your control?"}
    E -->|"Yes"| ADV["Advanced job"]
Figure 4. A quick decision chart for choosing a job type.

Single metric job

The simplest of all. It watches exactly one measurement, for example “the number of orders per five minutes” or “the average CPU use across the fleet.” It is the friendliest way to learn the feature because you can see one line, one shaded band of expected values, and the anomalies sitting on it. Think of it as watching one pulse on one heart monitor.

Multi-metric job

Here you watch several measurements at once, and optionally split them by one field, such as host name. If you ask for “average CPU and maximum memory, split by server,” the job builds a separate model for every server and every measurement. It is a wall of heart monitors, one per patient, all managed by a single nurse. This is the workhorse for infrastructure monitoring.

Population job

A population job compares members of a group with each other instead of with their own past. Imagine a company where 5,000 employees download files. Most download a few megabytes a day, but a few download gigabytes. A population job builds a picture of “what typical employees do” and flags those who stray far from the crowd. It is powerful for security, because a compromised account often behaves differently from its peers even if it has no long history of its own. The comparison is a teacher noticing that one child is doing something none of the classmates are doing.

Advanced job

The advanced wizard exposes every setting: several detectors, all field roles, custom rules, memory limits and more. It is what you reach for when the friendlier wizards cannot express your question, or when you want to save your configuration as a repeatable recipe.

Categorization job

Logs are often free text, and free text is hard to count. A categorization job first sorts messages into groups by their structure, so that “Connection to 10.0.0.5 timed out” and “Connection to 10.0.0.9 timed out” land in the same category because only the address differs. Then it watches how often each category appears. A brand-new category, or a category that suddenly explodes, is a strong signal that something new is going wrong. Picture a librarian who sorts thousands of letters by their type without reading names, and then notices that a new type of letter has started arriving.

Rare job

A rare job looks for values that almost never occur. “This program has never run on this server before.” “This user has never signed in from this country.” Either it compares against the entity’s own history, or against the whole population to say “almost no machine ever does this.” It is the party guest who says, “Wait, who is that person nobody has ever seen?”

Geographic job

Geographic jobs work on latitude and longitude pairs and flag places that are unusual. A user who always logs in from one city and suddenly appears on another continent is the classic example.

Ready-made jobs

You do not always have to design jobs yourself. Elastic ships groups of preconfigured jobs for common data sources, often called modules. Security products include jobs for unusual processes, odd network traffic and suspicious logins. Observability products include jobs for slow services, log message rates and host metrics. They are a superb starting point and a good way to see what well-designed jobs look like.

Job typeBest questionCompares against
Single metricIs this one number acting strangely?Its own past
Multi-metricIs any server acting strangely on any measurement?Each entity’s own past
PopulationWho behaves differently from everyone else?The crowd right now
AdvancedSomething custom with many detectorsWhatever you configure
CategorizationAre new or unusual log messages appearing?Each message category’s own past
RareDid something happen that hardly ever happens?History or crowd
GeographicDid activity appear in an unusual place?Past locations
!
Tip

Begin with a single metric or multi-metric job on data you understand well. Once you can predict what the job should find, move on to population and rare jobs, where the questions are subtler.

DDetectors, Functions and Fields

A detector is where you spell out the exact question. This chapter explains the vocabulary of functions and the three ways to split your data.

Functions: what to calculate

The function is the calculation performed on each bucket. Functions come in families, and most of them have “high” and “low” variants that tell the job which direction of surprise you care about. A plain count flags unusual numbers in either direction. A high count flags only surprisingly large counts, which is handy when a drop is harmless but a surge is not. A low count does the opposite, which suits watching for silence, such as a sensor that suddenly stops reporting.

FamilyExamplesTypical use
Countcount, high count, low count, non-zero count, distinct countEvent volumes, error bursts, how many different users or addresses appeared
Metricmean, median, minimum, maximum, and their high or low variantsResponse time, temperature, CPU, order value
Sumsum, high sum, low sumBytes transferred, money moved, items sold
Rarerare, frequently rareNever-before-seen processes, countries, or user agents
Information contentinfo content, high info contentRandom-looking text, such as machine-generated domain names
Timetime of day, time of weekActivity at unusual hours, such as logins at 3 a.m.
Geographiclatitude and longitude pairActivity in unusual places

The “non-zero count” family is worth a special mention. Some data is sparse: a bucket with no events is simply missing rather than being a real zero. Non-zero functions ignore empty buckets, which prevents the job from screaming about “no data” for something that only happens now and then.

Fields: how to split the data

Analyzing “all requests” as one lump hides problems. If one server out of a hundred is sick, the fleet average hides it. Splitting lets the job model each entity properly. There are three ways to split, and they behave differently.

Split

By field

Each value gets its own baseline and is compared with its own past. Like a separate report card for every student.

Isolate

Partition field

Each value gets a completely separate model and separately normalized scores. Like putting each student in a different classroom with a different teacher.

Compare

Over field

Each value is compared with the whole population of values. Like measuring one student against the rest of the class.

By field versus partition field

These two look alike but differ in an important way. With a partition field, every value is scored on its own scale. A very noisy server cannot use up the “surprise budget” and hide an odd moment on a calm server, because each server’s scores are normalized separately. With a by field, values share a scale, so the most unusual entity in the job earns the highest scores. Use partition when entities are truly independent, such as separate customers; use by when you want a global ranking of oddness.

Over field and population analysis

The over field switches on population analysis. Instead of asking “is this user different from their own history?” the job asks “is this user different from other users right now?” It is the right tool when individual histories are short, such as newly created accounts, or when you specifically care about outliers within a group. The models are also memory-friendlier than giving every entity a full history.

Influencers

After splitting, you list influencers, the fields you would want to see named when an anomaly appears. Usually you include the fields you split by and any others that could explain the story, such as data center, application version or customer. The job ranks the values of these fields by how much they contributed to each anomaly, and you see them highlighted in Kibana. Without influencers, you know that something is strange but not where to look first.

Worked example: an online marketplace

An online marketplace like Amazon might create a multi-metric job with two detectors: mean checkout time and count of failed payments. It splits by payment provider, so each provider is modeled on its own. Influencers include country and mobile app version. One evening the score for one provider jumps to 92, and the influencer panel shows a single app version in one country as the top contributor. Within minutes, engineers know exactly where to look.

How to choose a function: three questions

Choosing a function feels hard at first, but three questions settle most cases. First, are you interested in how many things happened, or in the value of something that was measured? If you care about volume, such as requests or errors, use a count-style function. If you care about a measured value, such as response time or temperature, use a metric-style function. Second, do you care about both directions of change, or only one? An error spike is bad but an error drop is fine, so a high variant fits. A sensor going silent is bad but a chattier sensor is harmless, so a low variant fits. Third, is your data steady or sparse? If events arrive only now and then, use the non-zero variants so that empty buckets are not treated as real zeros.

When you use counts on data that has already been summarized before it reaches the job, for example by an aggregated datafeed, the job needs to know how many original documents each summary row represents. A dedicated setting called the summary count field carries that number, and forgetting it makes counts come out wrong. It is like receiving a box of letters that is labeled “one bundle” when it actually contains a hundred letters.

Other useful settings

Two smaller options deserve a mention. Exclude frequent tells the job to ignore extremely common values, such as a load balancer’s own address, so they do not drown out real clues among the influencers. Use null decides whether records missing the split field should be analyzed as their own group. These settings rarely matter on day one, but they solve puzzling behavior later.

!
Watch out: cardinality

Cardinality means the number of different values a field has. A partition field with ten values is cheap. A partition field with ten million distinct values means ten million models, and the job will run out of memory. Always ask how many distinct values a split field holds before you choose it.

RReading the Results

A job is only useful if you can read its answers. This chapter shows what each result means and how to investigate an alert calmly.

Three levels of result

The job reports at three levels. Bucket results answer the big question: “How unusual was this whole time slice overall?” They carry one overall score, which combines everything that happened inside the slice. Record results give the detail: “Which specific entity and which detector was unusual, what did we expect, and what did we see?” Influencer results answer “who or what was involved?” and rank the entities across the whole time window.

Everyday analogy

Imagine a school inspector writing a report about a day. The bucket result is the headline grade for the whole day. The record results are the specific incident notes, such as “Room 12 was noisy at 10:15.” The influencer results are the list of pupils who appeared in most of the notes.

Scores and severity

Every score falls on the 0 to 100 scale. Kibana groups scores into colored bands so you can scan quickly.

BandApproximate scoreHow to think about it
WarningUp to 25Mildly unusual; worth a glance if you have time
Minor25 to 50Clearly unusual; check if it repeats
Major50 to 75Strongly unusual; investigate soon
Critical75 to 100Among the most unusual events the job has seen; investigate now

Remember that these bands measure unusualness, not badness. A critical anomaly can be wonderful news, such as sales tripling after a successful advert. The job cannot know what is good for your business. It only knows what is rare.

Actual, typical and the shaded band

Each record contains an actual value (what really happened) and a typical value (what the model expected). In the Single Metric Viewer, Kibana draws your data as a line, the model’s expected range as a shaded band around it, and anomalies as colored markers where the line escapes the band. Seeing the band move up and down through the week, following your real rhythm, is often the moment people understand how this feature works.

Anomaly Explorer

The Anomaly Explorer is the control room. It shows swim lanes, colored timelines that show when anomalies clustered, first for the whole job and then for each influencer value. Click a colored block and the lower part of the screen lists the anomalies inside it, with their actual and typical values, their influencers, and a small chart. It is designed for the question “I have got an alert; what happened around that time?”

1

Find the time

Open the Anomaly Explorer and locate the darkest block in the overall swim lane.

2

Find the who

Check the influencer swim lanes. One host, user or version often dominates.

3

Compare actual with typical

A value ten times higher than typical tells a different story from one that is twenty percent lower.

4

Look at the raw data

Jump from the anomaly to the underlying logs to read the real events.

5

Decide and teach

If it was expected, such as a planned sale, tell the system through a calendar event or a rule so it will not shout next time.

Extra details inside a record

Each record also carries several helpful fields. A short function description says which detector produced it, so you can tell a “high count” story from an “average latency” story. The probability is the raw rarity behind the score. The multi-bucket impact tells you whether the anomaly was mostly a single-bucket spike or a longer drift across several buckets. And results for a bucket that has not yet finished are flagged as interim: they are early opinions that can be revised once the whole bucket has arrived. If you only want stable facts, look at finalized results; if you want the earliest possible warning, interim results give you a head start with a little less certainty. It is the difference between a referee’s quick signal and the confirmed decision after the video replay.

Annotations, forecasts and searching results

Kibana lets you add annotations, short notes pinned to a moment on the chart, such as “deployed version 4.2.” The system also adds its own notes, for example when the model changes its behavior after a permanent shift. And because results are ordinary documents in indices, you can build dashboards that mix anomaly scores with business data, or write searches that ask “show me every critical anomaly for the payments service last week.”

i
Good to know

Scores of recent buckets may still be revised as the job sees more data, because normalization compares each moment with the strangest ones seen so far. If you alert on scores, allow a short settling period or use a moderate severity threshold rather than reacting to every tiny fluctuation.

AAdvanced Features That Make Jobs Smarter

Once the basics work, these features remove noise, add foresight, and let you steer the model when your business does something unusual on purpose.

Forecasting

The model that learned your rhythm can also look ahead. A forecast extends the learned pattern into the future and draws it with an upper and lower boundary, so you can see where a measurement is likely to be tomorrow or next week. Capacity planning is the classic use: “at this growth rate, our disk fills in eleven days.” A forecast needs the job to be open and is best suited to count and metric style jobs that track a single series or a split series. Some detector types, such as rare, geographic and population styles, cannot be forecast. The weather forecast is the everyday picture: it does not promise, it gives a likely range.

Scheduled events and calendars

Some unusual moments are unusual on purpose: a sale, a planned maintenance window, a holiday. You do not want the job to shout about them, and just as important, you do not want the model to learn from them and get confused. A calendar holds a list of scheduled events, each with a start and an end, and is attached to one or more jobs. During an event the job skips producing results and skips updating the model. It is like telling the night guard, “Tonight is the building party, so ignore the noise and please do not adjust your idea of a normal night.”

Custom rules

Sometimes the model flags something mathematically rare but practically boring. Perhaps traffic dropped from 12 requests to 3, which is a large percentage change but a trivial amount. A custom rule lets you say “ignore results when the actual value is below 20,” or “ignore anomalies for this list of test servers.” Rules can skip the result, skip the model update, or both. They can use conditions on the actual or typical value, and they can point at a filter list, a reusable list of values such as trusted server names, that you can edit without touching the job. It is telling the guard, “The janitor always comes at 3 a.m., so please do not report him.”

Model snapshots and reverting

Every few hours, and when a job closes, the job saves its model snapshot. If the model absorbed a bad period, for example a long outage that it began to treat as normal, you can revert to an earlier snapshot and replay the data from there. It is a save point in a video game: if the last level went badly, you go back to before it. Snapshots are kept for a limited time by default, and older ones are trimmed automatically, so keep any that you specifically care about.

Model plot

Turning on model plot tells the job to write the model’s expected bounds for each bucket into the results. This is what lets Kibana draw the shaded band around your data. It costs extra storage and processing, especially with many entities, so enable it selectively, often only for a chosen few entities.

Latency and out-of-order data

Data does not always arrive in perfect time order. The latency setting gives the job a short grace period to accept slightly late records before closing a bucket for good. It is a teacher who says, “Hand in your homework by Friday, but I will accept it until Monday morning.”

Multivariate analysis by field

Normally each value of a split field is modeled independently. If the values move together, for example the temperatures of several sensors in the same room, an option called multivariate by fields lets the model also learn the correlations, so it can notice when one sensor breaks the usual relationship with its neighbors.

Job groups and custom links

You can label jobs with groups, such as “payments” or “network,” which makes it easy to manage many jobs together and to attach a calendar to a whole group. You can also add custom URLs to a job so that a person looking at an anomaly can click straight through to a prepared dashboard or a filtered log search for the same time and entity. Shortcuts like these turn a chart into a starting point for action.

Look ahead

Forecast

Extends the learned pattern with a likely range for the days to come.

Planned

Calendars

Tell the job about sales, holidays and maintenance so it stays quiet and unbiased.

Tune

Custom rules

Filter out anomalies that are statistically rare but practically harmless.

Undo

Snapshots

Roll the model back to an earlier save point after a bad period.

Explain

Model plot

Shows the expected range so you can see why a point counted as unusual.

Link

Custom URLs

One click from an anomaly to the logs or dashboard that explain it.

PPerformance, Scalability and Reliability

What happens when you go from ten servers to ten thousand, or from thousands of events per minute to millions? This chapter explains the levers and the safety nets.

What actually costs resources

Three things drive the cost of a job. The first is the number of distinct entities it models, because each one needs its own model in memory. The second is the bucket span: shorter spans mean more buckets to analyze and more results to write. The third is the volume of data the datafeed has to search and transfer. Understanding these three tells you where to look when a job is slow or hungry.

The model memory limit

Each job has a model memory limit, its private backpack. The wizards estimate a sensible value from your data, and there is a cluster-wide ceiling to stop anybody from claiming too much. Setting it too small means the job reaches its limit and starts dropping detail. Setting it too large wastes memory that other jobs could use. Estimate first, add a healthy margin, and check the job’s memory status after a few days of real traffic.

Many small jobs or a few large ones?

A common mistake is creating one job per server. A hundred jobs means a hundred native processes, a hundred datafeeds and a hundred sets of overhead. One job that splits by server does the same analysis far more efficiently. As a general habit, use split fields inside one job instead of many separate jobs, and keep separate jobs for genuinely different questions or different data sources.

flowchart LR
    M["Master node - assigns jobs"] --> N1["ML node 1 - runs jobs A and B"]
    M --> N2["ML node 2 - runs job C"]
    M --> N3["ML node 3 - spare capacity"]
    N1 --> IDX["Results and state indices on data nodes"]
    N2 --> IDX
    N3 --> IDX
    N1 -.->|"if node 1 fails, job A moves"| N3
Figure 5. The master node places jobs on machine learning nodes and moves them if a node disappears.

Ways to scale up

1

Reduce the input

Filter the datafeed query so only relevant documents flow in. Watching only production traffic is cheaper than watching everything.

2

Summarize before sending

Use an aggregated datafeed so that Elasticsearch counts and averages first and only small summaries travel to the job.

3

Choose a sensible bucket span

Fifteen minutes is common. Shorter is faster to alert but noisier and more costly.

4

Use population analysis for huge crowds

It models the crowd’s behavior rather than a separate full history for millions of members.

5

Add machine learning nodes

More nodes mean more total memory for more jobs. Hosted Elastic deployments can add capacity automatically as demand grows.

Scale picture: a ride-hailing company

Imagine a company like Uber recording millions of trip events every minute across hundreds of cities. It would not send every raw event to one job. It would aggregate counts and average waiting times per city and per minute inside Elasticsearch, and let a job that splits by city analyze those small summaries. The volume the job handles drops by orders of magnitude while every city still gets its own learned rhythm.

Capacity planning in plain steps

Planning capacity does not need a spreadsheet full of formulas. Follow four simple steps. First, list the jobs you plan to run and, for each, count the distinct entities it will model, for example 3,000 servers or 500 services. Second, look at the memory estimate that Kibana gives for each job, which already takes entities and detectors into account. Third, add the estimates together and add a safety margin so that growth and pruning behavior have room to breathe. Fourth, compare that total with the memory your machine learning nodes are allowed to use for native processes, and add nodes until you have that total plus spare room for the loss of your largest node. Repeat this exercise whenever the business adds a large new source of data.

Think of packing a moving truck. You list the boxes, estimate their sizes, add space for surprises, and only then decide how many trucks to rent. Renting one truck too few is far more painful than renting one too many.

Reliability: what if a node dies?

Machines fail. The good news is that a job’s state is not trapped in one place. The configuration lives in a system index, and the model is saved regularly as snapshots. If a machine learning node vanishes, the master node detects it, chooses another node with enough free memory, and restarts the job there from its latest snapshot. Data that arrived between the last snapshot and the crash is simply replayed from the datafeed, and results resume. It is a relay race where the baton is always saved in a locker before a runner can trip.

The safety net needs room to work. If every machine learning node is nearly full, a failed job has nowhere to go and waits in an unassigned state until capacity returns. The job’s status includes an explanation of why it could not be placed. Keep spare capacity, at least enough to absorb the loss of your biggest node, and use replicas for the system indices so their data survives too.

Other reliability details

Datafeeds can search across several clusters, so a central cluster can analyze data that lives elsewhere, provided the nodes are set up to reach the remote clusters. After a major version upgrade, saved model snapshots from an older version may need an upgrade step before a job can use them, so read the upgrade notes before touching production. Finally, results and job statistics are ordinary data, so you can back them up with the same snapshot repository policy you use for every other index.

!
Watch out

A job that has hit its hard memory limit is not failing loudly. It keeps running but silently ignores new entities. Always monitor the memory status, described in the monitoring chapter, so you learn about this from a dashboard rather than from a missed incident.

AAdvantages, Disadvantages and Trade-offs

No tool is perfect. Knowing where anomaly detection shines and where it struggles helps you use it wisely.

Advantages

  • Learns normal behavior by itself, with no labels and no hand-tuned thresholds.
  • Understands daily and weekly rhythms and long-term trends.
  • Scales to thousands of entities in a single job.
  • Keeps adapting as the business changes.
  • Runs inside your own cluster, so data does not leave your environment.
  • Results are ordinary indexed data that you can search, chart and alert on.
  • Ready-made jobs exist for security and observability data.

Disadvantages

  • Needs a paid subscription tier or a trial.
  • Needs enough history before results are reliable.
  • Uses real memory and dedicated nodes at scale.
  • Tells you something is unusual, not why it happened.
  • Can slowly accept a gradual, harmful change as the new normal.
  • Poorly chosen bucket spans or split fields produce noisy or empty results.
  • Time-ordered data is required, so it does not suit static tables.

Trade-off one: sensitivity versus noise

Every detection system balances two mistakes. A false positive is a false alarm. A false negative is a missed problem. Raising the score at which you alert reduces false alarms but risks missing real trouble. Lowering it catches more but wakes people needlessly. There is no universally right level, so a good practice is to alert only on major and critical anomalies, review the minor ones during the working day, and move the dial as you learn your data.

Trade-off two: adapting versus forgetting

Because the model keeps learning, a slow and steady drift, such as a response time that creeps up a fraction of a percent every day, may eventually be accepted as normal. This is sometimes called the boiling frog problem. Fast jumps are caught easily, while very slow ones are absorbed. The remedy is to pair learned jobs with a few hard thresholds for values that must never be crossed, and to review long-term charts, not only alerts.

Trade-off three: speed versus certainty

Shorter buckets alert sooner, but each bucket holds less data and is therefore noisier. Longer buckets smooth out the noise but delay the alert. If you need both, run two jobs with different bucket spans on the same data: a short one for fast detection of big problems and a long one for careful detection of subtle ones.

How it compares with neighboring tools

ToolWorks onBest for
Fixed threshold alertAny numberHard limits and known dangers
Anomaly detection jobTime series data flowing in over timeUnknown dangers, rhythm-aware alerts, many entities
Outlier detection in data frame analyticsA static table of rowsFinding odd rows or odd customers in a snapshot of data
Change point and log rate analysisA window of time you chooseExplaining when and why a metric shifted, after the fact

These tools are teammates, not rivals. Anomaly detection tells you something changed; the analysis tools help explain the change; thresholds guard the hard limits.

SSecurity: Who Can See and Do What

Anomaly detection reads your data and writes new data about it. Both directions need care, and this chapter shows where the locks are.

Permissions come in two flavors

Elasticsearch security controls two separate things. Cluster privileges decide which actions a person may perform on the system as a whole, such as creating or deleting jobs. Index privileges decide which data a person may read. Anomaly detection needs both. To create a job, a person needs the right to manage machine learning and the right to read the source indices the job will study. It is like a library: one key opens the reading room, another key opens the rare book vault, and you may hold neither, one, or both.

Built-in roleWhat it allowsWho should have it
Machine learning adminCreate, edit, run and delete jobs, datafeeds, calendars and filtersThe small team that owns your detection setup
Machine learning userView jobs, results and forecasts, and explore them in KibanaAnalysts, on-call engineers and managers who consume results

Roles can be combined with your own custom roles. A common design gives analysts the viewer role plus read access to the dashboards they need, and gives only a handful of engineers the admin role.

Whose permissions does the datafeed use?

A datafeed runs in the background, possibly for months. When it searches your indices, it uses the permissions of the person who created it or who last updated it. If that person’s access is later reduced, the datafeed may start failing because it can no longer read the data, and a job that never sees data never finds anything. This is a surprising number of “my job stopped” mysteries. The fix is to create long-lived datafeeds under a well-governed service identity rather than a person who might change teams.

Results contain real values

Results are not anonymous numbers. When a job splits by user name or host name, those names appear in the results indices and in Kibana. So a person who can view results can learn which entities were involved, even if they are not allowed to read the raw logs. Treat the results indices as sensitive data of the same class as the source. If some teams must not see certain customers, use the security features that apply to the results, and use separate jobs and separate Kibana spaces for separate audiences.

Kibana spaces

Jobs can be assigned to spaces, which are like separate rooms inside one Kibana building. A payments team can see its jobs in its own space while a security team sees theirs, and neither is distracted by the other’s work. Spaces organize visibility; they are not a replacement for correct data permissions.

Protecting the machinery

The machine learning nodes talk to the rest of the cluster over the same internal channels as any other node, so those channels should be encrypted and authenticated in the usual way. Keep an audit trail of who creates, changes and deletes jobs, since a changed job can silently blind a monitoring system. A sneaky attacker who edits a rule to ignore his own machine has just tricked the guard.

!
Tip

Follow the principle of least privilege. Give viewers viewer rights, give owners admin rights, and review both lists every quarter. Fewer keys in circulation means fewer surprises.

Example: a bank’s segregated teams

Imagine a large bank like HSBC with a fraud team and a network operations team. Both use anomaly detection, but they must not see each other’s customer data. The bank gives each team its own space, its own roles and its own jobs, and reviews who holds the admin role every quarter. A departing engineer’s datafeeds are handed to a service account before the engineer’s access ends, so no detection quietly stops.

MMonitoring, Logging and Metrics

The watcher also needs watching. A job that quietly stops is worse than no job at all, because it gives false comfort.

Job statistics

Every job keeps a running scoreboard. The counts tell you how many records were processed, how many were skipped for missing fields or bad timestamps, and when the latest record arrived. If the number of processed records stops rising while the datafeed says “started,” something upstream is broken. If the skipped counts jump, your data changed shape, perhaps because someone renamed a field during a release.

Model size statistics and memory status

The scoreboard also shows how big the model is and reports a memory status with three values. “OK” means all is well. “Soft limit” means the job is nearing its limit and is pruning models it thinks are least useful. “Hard limit” means the limit has been hit, new entities are no longer modeled, and data is being dropped. Think of a fuel gauge with a yellow warning light and a red light. You want to act on the yellow one.

Datafeed statistics

The datafeed keeps its own numbers: its state, how many searches it has run, how long they took, and whether it is currently assigned to a node. A datafeed that is stopped, or unassigned, or whose searches are getting slower over time, needs attention. Slow searches usually point to a query that is too heavy or an index that is too large.

Messages and notifications

Kibana’s job management screen has a Job messages tab. Every important event, such as the job opening, the datafeed starting, a memory warning, a delayed data warning or an error, is written there and also to a notifications index. Because they are stored as data, you can search them, and even alert on them.

An alert for the alerter

Kibana includes a special alerting rule type that checks the health of anomaly detection jobs themselves. It can notify you when a datafeed is not running, when a job is not open, when memory status is a concern, when delayed data is detected, or when errors appear in the job messages. Setting this up on day one is one of the best investments you can make.

What to watchWhy it mattersHealthy sign
Job stateA closed or failed job analyzes nothingJob is open
Datafeed stateA stopped datafeed means no fresh dataDatafeed is started, and its node is assigned
Processed record countShows whether data really flowsRises steadily over time
Skipped or invalid recordsSignals a change in data shapeClose to zero
Memory statusShows whether the model fits its limitOK, not soft limit or hard limit
Delayed data warningsShows documents arriving too late to analyzeNone
Result freshnessConfirms buckets are still being scoredLatest bucket is within one or two spans of now

Logs

The cluster’s own logs record the lifecycle of the native processes and any failures they hit, such as being unable to start because of a memory shortage. When a job fails and the messages tab does not explain it, the logs of the machine learning node usually do. Ship those logs into Elasticsearch too, and then you can build a dashboard that shows the health of your monitoring system next to the health of the things it monitors.

i
Good to know

Stack Monitoring also tracks the cluster resources that jobs depend on, such as memory on the machine learning nodes and the health of the results indices. A quick daily glance at these numbers catches most slow-building problems.

AAlerting and the Wider Ecosystem

Finding an anomaly is only useful if the right person hears about it. This chapter connects results to notifications and to the products built on top of the feature.

flowchart LR
    J["Anomaly detection job"] --> R["Results index"]
    R --> AR["Anomaly detection alert rule - severity threshold"]
    R --> DASH["Dashboards and swim lane panels"]
    AR --> C1["Chat message"]
    AR --> C2["Email"]
    AR --> C3["Ticket or incident tool"]
    AR --> C4["Webhook to automation"]
    C4 --> ACT["Automatic action - scale out or block"]
Figure 6. From anomaly score to human notification and, optionally, to an automatic reaction.

The anomaly detection alert rule

Kibana’s alerting framework includes a rule type made for this job. You choose which jobs to watch, which kind of result to look at (bucket, record or influencer), and a minimum severity. The rule checks the results at regular intervals, looking back over a short window so that nothing slips through between checks. When a result crosses your severity level, the rule triggers actions through connectors: a chat post, an email, a ticket in your incident tool, or a web request that starts an automation.

A wise pattern is to send critical anomalies to the on-call person, major ones to a team chat channel, and everything below that to a dashboard that is reviewed during working hours. This keeps the night quiet and the day informed.

Elastic Security

Elastic’s security solution ships ready-made jobs for common threats: unusual processes on a machine, rare network destinations, suspicious logins, odd data volumes leaving a network, and patterns that resemble hidden channels through DNS. A detection rule type can turn an anomaly above a chosen score into a proper security alert, which then enters the same investigation workflow as any other alert. This is powerful because attackers who use stolen credentials do not trip signature-based rules, yet their behavior often differs from that of the real owner.

Elastic Observability

In the observability solution, anomaly detection is woven into the screens engineers use every day. Application performance monitoring can create jobs that watch each service’s latency, throughput and failure rate, and shows the anomaly right on the service map. Log screens use jobs that track log rates and categories, so a sudden flood or a new kind of message is highlighted. Infrastructure screens offer jobs for host memory, network traffic and container behavior. Engineers meet anomaly detection as a helpful colored marker on a chart they were already reading.

Security

Behavior-based threats

Unusual processes, rare destinations, odd logins and unexpected data volumes.

APM

Service health

Latency, throughput and failure rate learned per service.

Logs

Message patterns

Log rate changes and never-before-seen message categories.

Infrastructure

Hosts and containers

Memory, network and container behavior per machine.

Dashboards

Swim lanes and anomaly charts can be embedded into ordinary dashboards. A single screen can then show an order-volume chart, the latest anomaly heat-map for that same period, and a list of the top influencers. Seeing the business number and the anomaly signal next to each other shortens investigation time dramatically.

Closing the loop with automation

Because an alert can call a web address, you can connect anomalies to automation: open an incident, attach a link to the anomaly, add capacity, or temporarily block a suspicious address. Automatic reactions deserve caution. Start with automation that only gathers information, and give it power to change things only after you have watched the detections for a while and trust them.

!
Watch out

Never wire a low-confidence anomaly directly to a destructive action. Anomalies mean “unusual,” and unusual includes plenty of harmless situations, like a marketing campaign that worked.

DDesign Patterns and Anti-Patterns

Patterns are recipes that experienced teams keep repeating because they work. Anti-patterns are the traps those same teams learned to avoid.

Patterns worth copying

Pattern

Learn first, alert later

Run a job in lookback mode over weeks of history, review its results, and only then connect notifications. Like an apprentice who observes before being trusted with the shop.

Pattern

One job, many entities

Use a split field so one job models every server, customer or region instead of creating a job for each.

Pattern

Two speeds

Pair a short-bucket job that catches sharp problems quickly with a long-bucket job that catches slow, subtle ones.

Pattern

Guardrails plus learning

Keep fixed thresholds for hard limits such as a full disk and use learned jobs for everything with a rhythm.

Pattern

Calendar first

Enter planned sales, holidays and maintenance in a calendar before they happen so they do not pollute the model.

Pattern

Detect, then explain

Use anomaly detection to say when and where, and use custom links to jump straight to the raw logs that say why.

Traps to avoid

ANTI-PATTERN 01Avoid
What it looks like

A separate job for every server, every service and every customer.

Why it hurts

Each job runs its own native process, holds its own overhead and needs its own care. Hundreds of tiny jobs exhaust memory and become impossible to manage.

Do this instead

Use one job with a split field. The model still learns each entity separately, but the machinery is shared.

ANTI-PATTERN 02Avoid
What it looks like

Splitting by a field with millions of distinct values, such as a session identifier or a full web address including its unique parameters.

Why it hurts

Every new value creates a new model, so memory is consumed by entities that will never be seen again, and the job soon reaches its hard limit.

Do this instead

Split by something meaningful and limited, such as a service or a region, and use a population job when the number of members is huge.

ANTI-PATTERN 03Avoid
What it looks like

Paging a human for every anomaly, including the mildest ones.

Why it hurts

People quickly learn to ignore the noise, so the one real alert is ignored along with the rest. This is called alert fatigue.

Do this instead

Alert only on major and critical results, and send everything else to a dashboard reviewed at a calm time.

ANTI-PATTERN 04Avoid
What it looks like

Mixing very different kinds of data in one job, such as production and testing traffic, or several customers with different behaviors and no split field.

Why it hurts

The blended average describes nobody. Real problems in one group are hidden by the normal behavior of another, and test noise triggers false alarms.

Do this instead

Filter the datafeed to the relevant slice or split the analysis by the field that separates the groups.

ANTI-PATTERN 05Avoid
What it looks like

Creating jobs and never looking at them again.

Why it hurts

Data changes shape, teams rename fields, memory fills up, and datafeeds lose permissions. Nobody notices, and the monitoring silently rots.

Do this instead

Add the job health alert rule and review each job’s usefulness every quarter, retiring the ones that nobody looks at.

BBest Practices and Common Mistakes

A short, practical checklist drawn from the way careful teams roll this feature out.

1

Start with a clear question

“Tell me when checkout gets slower than usual for any payment provider” is a good question. “Find anything weird” is not. A crisp question chooses the detector, the split field and the influencers for you.

2

Check the data before you model it

Make sure the timestamp is trustworthy, the fields are present and consistently named, and the volume is enough. A job can only be as good as its data.

3

Choose the bucket span deliberately

Use the estimation helper, and remember that the span should not be far shorter than how often your data actually arrives. Sparse data in tiny buckets creates constant false alarms.

4

Feed it history

Give the job several weeks of past data in lookback mode, so it starts with a real education instead of a blank mind.

5

Review, then tune

Study the first week’s anomalies with the people who know the system. Add calendar events, custom rules and better influencers where the results show a need.

6

Connect alerts gradually

Begin with a dashboard, add chat notifications for major anomalies, and only then page humans for critical ones.

7

Monitor the jobs themselves

Turn on the job health alert, watch memory status and remember that people who leave the company may hold the permissions your datafeeds run under.

Common mistakes and their cures

MistakeWhat you seeThe cure
Too little historyNoisy, erratic early resultsRun a lookback over weeks of data before trusting alerts
Bucket span too short for sparse dataMany anomalies about “no data”Lengthen the span or use non-zero functions
No influencersYou know something is wrong but not whereAdd the fields you split by and other explanatory fields
Ignoring planned eventsAlerts on every sale and maintenance windowAdd calendars with scheduled events
Memory limit set by guessJob reaches a soft or hard limitUse the estimate, add margin, and watch the memory status
Datafeed under a personal accountJob stops after the person changes rolesCreate datafeeds with a service identity
Trusting scores blindlyPanic over harmless good newsRemember unusual does not mean bad; check the raw data
Watching only anomaliesA slow drift is absorbed as normalKeep hard thresholds and review long-term charts
!
Tip

Write down, for each job, one sentence describing the question it answers and who acts on its alerts. If you cannot write that sentence, the job probably should not exist yet.

RReal-World and Industry Examples

Here is how the same engine adapts to very different industries. Named companies below are used as familiar illustrations of the kind of scale and problem involved, not as claims about their internal systems.

Security: the stolen key

A thief who steals an employee’s password does not need to break anything, and no rule says “this employee must not sign in.” But the thief probably signs in at odd hours, from a new country, and starts touching servers the employee never uses. A rare job and a geographic job watching sign-in behavior would flag that account within minutes. Elastic’s own security solution ships jobs of exactly this flavor.

Application performance: the hidden regression

A software company deploys a new version on Tuesday. Average latency across all services barely moves, but one service in one region starts taking longer. A job on latency, split by service and region, learns each pair’s normal and points to the exact pair. The engineers compare the anomaly’s start time with the deployment annotation and roll back within the hour.

Retail: the missing orders

Picture a retailer of Amazon’s size on a normal Wednesday. Orders per minute follow a beautiful daily wave. At 2:40 p.m. the wave dips forty percent below its usual level for one payment method. A low count job, split by payment method, reports a critical anomaly while customer complaints are still zero. The cause turns out to be an expired certificate at one payment partner.

Streaming: the quiet region

A streaming service like Netflix watches video start-up time per region and per device type. When a new firmware update makes one television brand buffer for two extra seconds, the average across millions of viewers barely twitches, but the model for that brand and region shows a sharp departure from its own history.

Industry: the machine that hums differently

A factory such as one of Siemens’ plants might record vibration and temperature from hundreds of machines. A multi-metric job split by machine learns each machine’s healthy signature. When a bearing begins to wear, the vibration pattern changes slightly weeks before it fails, and the maintenance team schedules a repair during a planned stop instead of an emergency.

Finance: the unusual payment pattern

A card network like Visa processes enormous numbers of payments. A population job comparing merchants with each other, on measures such as transaction size and frequency, flags the few merchants whose behavior differs sharply from similar merchants. Investigators then look at those few rather than at millions.

A complete walk-through: checkout latency

To make everything concrete, here is how a team might build one job from start to finish.

1

Ask the question

“Tell me when checkout takes unusually long for any payment provider.”

2

Pick the job type

A multi-metric job with mean checkout time, split by payment provider, with country and app version as influencers.

3

Set the bucket span

Fifteen minutes, chosen because payment data arrives every few seconds and the team wants quick, stable detection.

4

Backfill

Start the datafeed four weeks in the past so the model learns weekday and weekend rhythms, then let it continue in real time.

5

Review and tune

Add a calendar for the yearly sale and a rule that ignores anomalies when checkout takes less than a tenth of a second.

6

Alert

Post major anomalies to the payments channel and page the on-call engineer for critical ones, with a link to the matching logs.

FFrequently Asked Questions

Short answers to the questions that beginners ask most often.

Q1Is Elasticsearch anomaly detection the same as artificial intelligence chat models?
No. It is a different kind of machine learning. It uses statistical and probabilistic models that learn the rhythm of your numbers, not language models that read and write text. It does not need you to train it with labeled examples.
Q2Do I need to be a data scientist to use it?
No. The Kibana wizards guide you through choosing a job type, a bucket span and fields. An understanding of your own data matters more than a knowledge of statistics.
Q3How much data does a job need before it becomes reliable?
A few hundred buckets give a reasonable picture of ordinary behavior. If your data has weekly cycles, about three weeks of history helps the model learn them. More history is better, and lookback mode lets you supply it instantly.
Q4What is the difference between a job and a datafeed?
The job holds the analysis instructions and the learned model. The datafeed is the pipe that fetches data from your indices and hands it to the job. A job must be open, and its datafeed started, for anything to be analyzed.
Q5Can it work on data that is not stored in Elasticsearch?
A datafeed reads from Elasticsearch indices, so the data should be ingested there first. Data can also be sent to a job directly through its programming interface, but most people ingest into Elasticsearch, which also gives them searching and dashboards for free.
Q6Why did my job report an anomaly when everything looked fine?
Anomalies mean “unusual for this data,” not “broken.” A successful campaign, a holiday or a planned migration can all be unusual. Check the raw data, and use calendars or custom rules to teach the job about expected events.
Q7Why did the score of an earlier anomaly change?
Scores are normalized against the most unusual moments seen so far. If something more extreme occurs later, earlier scores can shift. Results keep an initial score and a current score so you can see both.
Q8What happens if my data arrives late?
If documents reach Elasticsearch after the datafeed has already read that time window, the job never sees them. Raise the query delay to fit your ingest speed, and watch for the delayed data warnings.
Q9Does it slow down my searches?
Jobs run on machine learning nodes and use memory outside the normal search heap, so with dedicated nodes they do not compete with user searches. The datafeed does run searches on your indices, so keep its query efficient.
Q10Can it predict the future?
Partly. It can forecast counts and metrics by extending the learned pattern, with an upper and lower range. It does not predict individual unexpected events. It predicts the shape your data usually follows.
Q11Can I stop it from flagging things I already know about?
Yes. Use calendars with scheduled events for planned periods, and custom rules with conditions or filter lists for entities and values you want ignored.
Q12What happens to the model when I close a job?
The job saves a model snapshot, so when you open it again it continues from what it had learned. Deleting the job, however, removes its results and snapshots.
Q13Should I still use normal threshold alerts?
Yes, for hard limits that must never be crossed, such as a nearly full disk. Use learned jobs for everything that has a rhythm or an unknown failure mode.

SSummary and Key Takeaways

The whole article in one place. If you remember only this box, you still know the essentials.

Key Takeaways

  • What it is: Anomaly detection in Elasticsearch is a built-in, unsupervised machine learning feature that learns what normal looks like in time series data and flags what does not fit, with no labels and no hand-tuned thresholds.
  • The parts: A job holds the question and the model, a datafeed brings the data, buckets slice time, detectors define the calculation, and results come back as scores from 0 to 100 stored in searchable indices.
  • How it thinks: For every bucket the job predicts what it expected using trend, cycles and noise, measures how improbable the real value was, turns that into a score, and then keeps learning.
  • Choose the right shape: Use single metric to learn, multi-metric for fleets, population for comparing entities, categorization for logs, rare and geographic for unusual values and places, and advanced for full control.
  • Run it responsibly: Watch memory, limit split-field cardinality, use one job with many entities rather than many jobs, give datafeeds stable identities and add the job health alert.
  • Teach it your business: Feed history first, then add calendars, custom rules and influencers so that planned events do not raise false alarms.
  • Use it as a teammate: Pair learned jobs with fixed thresholds, alert only on major and critical anomalies, and remember that unusual does not always mean bad.