Summary
Filtering for empty string or null values is unreliable. The behaviour is endpoint- and field-specific — works on some, silently returns wrong results on others.
Empty string filter (field:)
field: generates filter=field:"". Results by endpoint/field:
| Endpoint |
Field |
field: filter |
Result |
| DeviceList |
description |
description:"" |
Works — excludes non-empty descriptions ✓ |
| AlertList |
ackedBy |
ackedBy:"" |
Broken — returns all records including non-empty ackedBy ✗ |
Null filter
field:null generates filter=field:"null" (elm quotes the value). This matches the literal string "null", not JSON null. There is no way to filter for actual null values server-side.
Workaround
Filter client-side with jq after fetching:
# Empty string
elm -f json AlertList -F 'cleared:false' -s0 | jq '.AlertList[] | select(.ackedBy == "")'
# Null
elm -f json AlertList -s0 | jq '.AlertList[] | select(.SDT == null)'
Notes
- The empty string bug is likely the same class of issue as the
!: / !~ NOT operator bug (#48) — elm sends the correct URL, the LM API silently misapplies the filter.
- Confirmed with
elm -f api that the URL encoding is correct.
Summary
Filtering for empty string or null values is unreliable. The behaviour is endpoint- and field-specific — works on some, silently returns wrong results on others.
Empty string filter (
field:)field:generatesfilter=field:"". Results by endpoint/field:field:filterdescription:""ackedBy:""Null filter
field:nullgeneratesfilter=field:"null"(elm quotes the value). This matches the literal string"null", not JSON null. There is no way to filter for actual null values server-side.Workaround
Filter client-side with jq after fetching:
Notes
!:/!~NOT operator bug (#48) — elm sends the correct URL, the LM API silently misapplies the filter.elm -f apithat the URL encoding is correct.