Boolean Logic
Boolean Operators
Section titled “Boolean Operators”FlyQL uses three boolean operators to combine conditions:
| Operator | Meaning | Example |
|---|---|---|
and | Both conditions must be true | status=200 and active |
or | Either condition can be true | level=error or level=critical |
not | Negates an expression | not archived |
Combined Negation
Section titled “Combined Negation”not can be combined with and and or:
active and not archivedlevel=error or not healthyOperator Precedence
Section titled “Operator Precedence”and binds tighter than or. This means:
a=1 or b=2 and c=3is parsed as:
a=1 or (b=2 and c=3)To override precedence, use parentheses explicitly.
Parenthesized Grouping
Section titled “Parenthesized Grouping”Use parentheses to control evaluation order:
(status>=400 or level=error) and service=apiWithout parentheses, and would bind tighter:
status>=400 or level=error and service=api→ status>=400 or (level=error and service=api)Nested Grouping
Section titled “Nested Grouping”Parentheses can be nested:
(a=1 or b=2) and not (c=3 and d=4)Negating Groups
Section titled “Negating Groups”not applies to the entire group:
not (status=200 and healthy)This negates the combined condition — true only when either status is not 200 or healthy is false.
Negation
Section titled “Negation”not negates any expression — a truthy check, a comparison, or a group:
not active # field is falsynot status=200 # status is not 200not (a=1 and b=2) # negates the groupactive and not archived # combined with other conditionsDouble negation cancels out: not not active is equivalent to active.
Examples
Section titled “Examples”# Simple ANDstatus=200 and service=api
# Simple ORlevel=error or level=critical
# Mixed with precedencestatus>=400 or level=error and service=api
# Explicit grouping(status>=400 or level=error) and service=api
# Complex query with negation and grouping(status>=500 and host=prod*) or (level=error and not service=healthcheck)