Berserk Docs
Scalar Functions

Scalar Operators

Operators that compare, combine, and test values in expressions

Scalar operators evaluate to a single value. They form the boolean predicates used in where, the computed columns in extend and project, and any other place an expression is expected. Results combine with and, or, and not.

Comparison, arithmetic, and logical

OperatorDescriptionExample
==Equal; strings compare case-sensitively1 == 1, "abc" == "abc"
!=Not equal1 != 2
=~Equal, case-insensitive (strings)"aBc" =~ "AbC"
!~Not equal, case-insensitive"abc" !~ "xyz"
<Less than1 < 2
<=Less than or equal1 <= 2
>Greater than2 > 1
>=Greater than or equal2 >= 1
+Add2 + 1, now() - 1h
-Subtract5 - 2
*Multiply2 * 3
/Divide6 / 2
%Modulo5 % 2
andLogical and(x > 0) and (y > 0)
orLogical or(x > 0) or (y > 0)
not(…)Logical negationnot(isempty(name))

Membership and range

OperatorDescriptionExample
inValue equals any item in the listlevel in ("error", "warn")
!inNegation of inlevel !in ("info", "debug")
in~Case-insensitive inlevel in~ ("Error", "Warn")
!in~Negation of in~
betweenValue within an inclusive rangex between (1 .. 10)

x in (v1, v2, …) is exactly equivalent to (x == v1) or (x == v2) or …; in~ uses case-insensitive equality. The list must be non-empty and all values must share a type — integers and reals form one numeric family, so x in (1, 2.5) is allowed, while a mixed list such as x in (1, "a") is an error. The value is compared by its native type, so membership on a dynamic field keeps bloom and shard pruning engaged with no cast.

String operators

String operators test strings using infix notation. Most have a case-sensitive variant (suffixed with _cs).

OperatorDescriptionCase-SensitiveExample
containsIndicate whether a string contains another string (case-insensitive).No"value" contains "test"
!containsNegation of containsNo
contains_csIndicate whether a string contains another string (case-sensitive).Yes"value" contains_cs "test"
!contains_csNegation of contains_csYes
endswithIndicate whether a string ends with another string (case-insensitive).No"value" endswith "test"
!endswithNegation of endswithNo
endswith_csIndicate whether a string ends with another string (case-sensitive).Yes"value" endswith_cs "test"
!endswith_csNegation of endswith_csYes
hasIndicate whether a string contains a whole word (case-insensitive, word boundary matching).No"value" has "test"
!hasNegation of hasNo
has_csIndicate whether a string contains a whole word (case-sensitive, word boundary matching).Yes"value" has_cs "test"
!has_csNegation of has_csYes
hasprefixIndicate whether a string starts with a word prefix (case-insensitive, word boundary matching).No"value" hasprefix "test"
!hasprefixNegation of hasprefixNo
hasprefix_csIndicate whether a string starts with a word prefix (case-sensitive, word boundary matching).Yes"value" hasprefix_cs "test"
!hasprefix_csNegation of hasprefix_csYes
hassuffixIndicate whether a string ends with a word suffix (case-insensitive, word boundary matching).No"value" hassuffix "test"
!hassuffixNegation of hassuffixNo
hassuffix_csIndicate whether a string ends with a word suffix (case-sensitive, word boundary matching).Yes"value" hassuffix_cs "test"
!hassuffix_csNegation of hassuffix_csYes
matches regexReturns true if the string matches the regular expression pattern.No"value" matches regex "test"
startswithIndicate whether a string starts with another string (case-insensitive).No"value" startswith "test"
!startswithNegation of startswithNo
startswith_csIndicate whether a string starts with another string (case-sensitive).Yes"value" startswith_cs "test"
!startswith_csNegation of startswith_csYes

Function call syntax

Most string operators can also be called as functions (except multi-word operators like matches regex). For example:

T | where contains(name, "search")

is equivalent to:

T | where name contains "search"

On this page