Join our Newsletter — 33% off our NHI Course
Home› FAQ› Cyber Security› What is the difference between contains, starts with,…
Cyber Security

What is the difference between contains, starts with, ends with, and does not equal filters in J1QL?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated September 27, 2026 Domain: Cyber Security

These operators support different kinds of precision filtering. Contains matches values with a substring, starts with and ends with match prefixes or suffixes, and does not equal excludes exact matches. The practical difference matters because each operator changes how broad the result set is, especially when you are filtering hosts, certificates, or user attributes.

How the four J1QL filters differ in match scope

In J1QL, these filters are really about how much of a value must match. contains looks for a substring anywhere in the field. starts with and ends with are directional string matches. does not equal is an exclusion filter, so it removes exact matches rather than searching for a pattern.

The practical difference is precision. A substring filter can return many more results, while prefix or suffix matching narrows the search to a known naming pattern. Exact inequality is the sharpest of the four when you want to exclude one known value without affecting similarly named values.

How each operator behaves on real data

contains is best when the value may appear in the middle of a longer string, such as a host name, certificate subject, or user attribute that uses embedded naming conventions. It is the broadest pattern option here, so it is useful for discovery but easier to over-match.

starts with is the right choice when the field has a predictable prefix, such as an environment tag, region code, or naming standard. ends with is the mirror image, useful when the most stable part of the value sits at the tail, such as a domain suffix or identifier ending. In both cases, the match boundary helps keep results more intentional than a generic substring search.

does not equal behaves differently because it is not a pattern operator. It excludes the exact value you name, but it does not remove values that merely contain that text or resemble it. That makes it useful for cleanup queries, exception handling, and filters where one known value must be removed from a broader set.

Choosing the right filter in J1QL queries

The choice usually comes down to whether you know the stable part of the value. If you only know part of the text, contains is the most forgiving. If you know the naming convention, use starts with or ends with to reduce noise. If you already know the exact value you want to exclude, does not equal is the cleanest option.

These operators also differ in how they affect result-set size. A wider match can be helpful when you are hunting for unknown assets, but it can also hide the signal you care about. A narrower match is usually better for reporting, alert triage, and policy checks where false positives waste time.

Risk and Threat Considerations

Filtering mistakes in J1QL can create operational blind spots, especially when the query is used to find hosts, certificates, or user attributes that need review. A broad contains query may pull in unrelated items, while an overly narrow prefix or suffix query may miss assets whose naming is inconsistent.

Failure mechanism: The query author chooses a match operator that does not reflect the real naming pattern, so relevant records are excluded or buried in noise. That can leave stale certificates, unmanaged hosts, or unexpected user values outside the review set.

Impact: Teams can undercount exposure, miss remediation targets, or make decisions based on incomplete inventories. In a security workflow, that can translate into undetected drift, missed exceptions, or incorrect approval decisions.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5, CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5SI-4 — System MonitoringJ1QL filters affect whether review queries surface the right security records.
Recommendation — Tune queries to improve monitoring coverage and reduce missed records.
CIS Controls v8CIS-8 — Audit Log ManagementAccurate filtering matters when reviewing logs, hosts, or identities for investigation.
Recommendation — Use precise filters to keep audit review queries complete and actionable.
NIST CSF 2.0ID.AM-01 — Physical devices and systems are inventoriedThe filter choice affects inventory queries used to locate assets and exceptions.
Recommendation — Use the narrowest filter that still reliably captures the inventory population.

Practitioner Guidance

What to verify: Test the filter against a small known dataset before trusting it in production reporting. Confirm that the operator returns the records you expect, and check at least one positive case and one near miss so you can see the boundary behavior.

Common mistake: Treating contains as if it were a safe substitute for exact matching. If the field has a controlled format, a broader substring search often produces too many results to support a reliable decision.

Practitioner takeaway: Choose the least permissive operator that still matches the data pattern you actually have, not the pattern you hope the data follows.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 27, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org