Skip to main content

join

Join the current result set with a subsearch on a common field.

Syntax

| join type=<join-type> <field> [<subsearch>]

Arguments

ArgumentDefaultDescription
typeinnerJoin type: inner, left, outer
fieldRequiredField(s) to join on
subsearchRequiredSubsearch enclosed in [...]

Examples

-- Inner join
source=nginx | join type=inner user_id [search source=auth | stats count AS login_count by user_id]

-- Left join
source=nginx | join type=left client_ip [search source=geo | fields client_ip, country, city]

-- CTE-based join
$threats = FROM main WHERE threat_type IN ("sqli", "xss") | FIELDS client_ip, threat_type;
$logins = FROM main WHERE type="login" AND result="failed" | STATS count AS failures BY src_ip;
FROM $threats | JOIN type=inner client_ip [$logins] | WHERE failures > 5

Notes

  • Join loads the right-side (subsearch) into memory. For large datasets, consider using stats with computed keys instead.
  • Join executes on the coordinator, not pushed to shards.

See Also