Skip to main content

GROUP BY

GROUP BY id is supported and groups by document id. On large tables, that can produce one group per row.

Global count

Use this for total rows. It is faster than grouping by id.

WHERE

Comparison operators: =, !=, <, <=, >, >=.

IN, BETWEEN, LIKE

NOT BETWEEN and NOT LIKE are supported. LIKE uses % (any run) and _ (single char) and is case-sensitive.

Aggregates

Aggregate over a function

Aggregates can wrap a scalar function:

Aliases

Name the output value column with AS:

GROUP BY a function

Group by a computed key, e.g. bucket timestamps by month:

HAVING

Filter groups after aggregation. Reference the aggregate value column by its output name (count, sum_<col>, avg_<col>, …, or an alias) or the group key column:
Comparison operators, IN, BETWEEN, and LIKE are supported in HAVING. Use the value column name (count, sum_score) — not the COUNT(*)/SUM(...) expression.

Retrieval + analytics

Apply search first, then aggregate:
Hybrid example: