In modern detection engineering, a rule is often misunderstood as just a query that triggers alerts. In reality, within Elastic Security, a detection rule is a structured, versioned, and lifecycle-managed object that goes far beyond simple query logic.
Understanding this structure is essential for anyone operating in a Security Operations Center (SOC), especially when managing large-scale detection content and updates.
A detection rule is composed of multiple layers, each serving a specific purpose:

Elastic separates:
This design allows Elastic to:
Rule evolution is governed by two independent mechanisms:
version
revision
This distinction is particularly important in large SOC environments, where maintaining control over updates while preserving local modifications is critical.
Each rule carries important context about its origin and modification status:
This information forms the backbone of safe and controlled content upgrades. It allows teams to confidently apply updates without losing custom work.

Elastic Security includes a built-in three-way merge system for rule updates. This is implemented through the diff object, which tracks changes at the field level.

Each field includes:
This is effectively a three-way merge engine built into Elastic Security.
It allows:
While detection logic is central, it is only one part of the rule.
Different rule types introduce distinct internal structures. For example:
Each type brings its own configuration and behavior, reinforcing that rules are not uniform objects but type-driven systems.
EQL Rule

New Terms Rule

Rules also include execution-related parameters such as:
These directly impact:
Using timestamp_override: event.ingested ensures that late-arriving data is evaluated correctly, improving detection accuracy in delayed ingestion scenarios.
Detection rules also embed metadata designed to support analysts during investigations. These elements drive:
This is not part of detection logic itself—it is an intentional design to enhance analyst workflows and reduce investigation time.

Rules can declare dependencies on integrations and required ECS fields. This enables:

And required ECS fields:

From the structure alone, we can infer:
Elastic Security is not just running queries — it is managing detection-as-code with version control semantics.
The internal structure of a detection rule reveals Elastic Security’s core design philosophy:
Detection rules are versioned, mergeable, dependency-aware, and analyst-enriched content artifacts—not just saved searches.
Understanding this model provides:
Most importantly, it gives you full control over your detection lifecycle.