Skip to main content

FROM

Specify a data source to read events from. By default, queries read from the main index.

Syntax

FROM <source> [WHERE <expression>]

Arguments

ArgumentRequiredDescription
sourceYesIndex name, materialized view name, or CTE variable

Examples

-- Read from the default index
FROM main

-- Read from a named index
FROM production

-- Read from a materialized view
FROM mv_errors_5m | where source="nginx"

-- Read from a CTE variable
$errors = FROM main WHERE level="error" | FIELDS source, message;
FROM $errors | stats count by source

-- With inline WHERE
FROM main WHERE level="error" AND source="nginx"

Notes

  • If your query starts with |, FROM main is automatically prepended.
  • When reading from a materialized view, the optimizer checks whether the view can accelerate the query.

See Also

  • search -- Full-text search
  • where -- Filter by expression