Skip to content

Filtering for empty string or null values is unreliable on some endpoints #50

@rdmarsh

Description

@rdmarsh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream-bugBug in an upstream dependency (LM API, etc.) — should be raised with vendor

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions