Less Than
Checks if a numeric value is less than a specified threshold.
Overview
The less_than condition evaluates whether a field's numeric value is below a specified threshold. This is useful for filtering low-priority items, checking for values within acceptable ranges, and implementing minimum thresholds.
Use Cases
- Low-Priority Filtering: Route low-severity events differently
- Resource Optimization: Handle small payloads or low-traffic requests
- Quota Management: Check remaining quotas or limits
- Quality Gates: Filter out items below minimum thresholds
Configuration
| Setting | Type | Required | Description |
|---|---|---|---|
key | string | Yes | The field path to check. Supports dot notation for nested fields. Use * to check all keys. |
value | number | Yes | The threshold value to compare against. |
not | boolean | No | If true, inverts the condition (matches if value is NOT less than threshold, i.e., greater than or equal). |
Examples
Basic Threshold Check
Route low-priority events:
Code
Matches:
Code
Does not match:
Code
Small Payload Handling
Route small payloads for faster processing:
Code
Matches:
Code
Error Rate Check
Filter for acceptable error rates:
Code
Matches:
Code
Nested Field Check
Check nested numeric values:
Code
Matches:
Code
Greater Than or Equal (using not)
Match values at or above a minimum:
Code
Matches:
Code
Does not match:
Code
Remaining Quota Check
Check if quota is running low:
Code
Matches:
Code
Common Patterns
Fast Path for Small Requests
Route small requests to optimized processing:
Code
Low-Priority Queue
Route low-priority items separately:
Code
Range Check (Between Two Values)
Route values within a specific range (e.g., 0 <= value < 50):
Code
Minimum Threshold Enforcement
Ensure values meet minimum requirements:
Code
This matches records where confidence >= 0.8.
Resource Monitoring
Alert on low resources:
Code
Time-Based Filtering
Filter recent events (timestamp in seconds):
Code
Best Practices
-
Use appropriate precision: Consider floating-point precision when setting thresholds.
-
Combine with
greater_thanfor ranges: Use both conditions to define numeric ranges. -
Remember exclusive comparison:
less_thanis exclusive (<, not<=). -
Use
notfor inclusive bounds:less_thanwithnot: truegives you>=. -
Document threshold values: Make it clear why specific thresholds were chosen.
Type Handling
| Data Type | Behavior |
|---|---|
| Numbers | Standard numeric comparison |
| Numeric strings | Parsed and compared as numbers ("42" works like 42) |
| Non-numeric strings | Returns false |
| Booleans | Not supported (returns false) |
| Arrays | Not supported (use array index to access elements) |
| Null | Returns false |
| Missing | Returns false (or true if not is set) |
Comparison Reference
| Condition | Result for value=3, threshold=5 |
|---|---|
less_than (value: 5) | true (3 < 5) |
less_than (value: 5, not: true) | false (3 >= 5 is false) |
less_than (value: 3) | false (3 < 3 is false) |
less_than (value: 1) | false (3 < 1 is false) |
Limitations
- Only works with numeric values
- Non-numeric fields return
false - No support for string comparison
- Exclusive comparison only (use
notfor inclusive bounds)
Troubleshooting
Condition not matching:
- Verify the field contains a numeric value (numeric strings like
"42"also work) - Check if the field exists (missing fields return
false) - Confirm the threshold value is correct
Boundary issues:
- Remember
less_thanis exclusive (<, not<=) - Use
not: trueif you need>=behavior - Combine with
greater_thanfor range checks
Zero value handling:
- Zero is a valid number and will be compared normally
less_thanwith value0matches negative numbers only