Skip to main content
Filter expressions are used when doing lookups in JSON or JavaScript schemas. Each section below shows what you can write, with an example for both schema types.
If you are using JavaScript and your filter contains expressions, it’s often easier to use string interpolation instead of string concatination. See MDN Web Docs .
If you are comparing values containing URI special characters, you should URI encode the value in your filter expression. See MDN Web Docs.

Compare values

EQUALS operator
NOT EQUALS operator
ne doesn’t match source entities that don’t have the property. properties.status ne 'archived' skips every source entity without a status. eq null doesn’t match them either, as it only matches a property that is set to null. If you need to include them, make sure every source entity has the property.

Combine conditions

AND operator
OR operator
Use parentheses to group conditions when you mix and and or.
Group conditions with parentheses

Match a value in a list

Check whether the element exists in this collection

Arrays

Use any to check the items of an array property, for example redirects or an array property on the source entity. Name the item in front of the colon, then write the condition for one item after it.

Contains a matching value

Contains a matching value
Conditions combined with and inside any must all match the same item. properties.articles/any(a: a.isFeatured eq true and a.category eq 'sport') only matches if one article is both featured and in the sport category, not if one article is featured and another is in the sport category.An and that no single item can satisfy isn’t an error, it just never matches. properties.tags/any(t: t eq 'news' and t eq 'sport') finds nothing, because no tag is both. To match source entities that have both tags, use two any joined with and, as in the “Contains both tags” example.

Build the list of values from the source entity

In a JavaScript schema you can build the or list inside any from the source entity, for example from a list of selected tags. in isn’t supported inside any, so join eq comparisons with or instead:
Match any of the selected tags
With selectedTags set to ['news', 'sport'], the filter becomes type eq 'article' and properties.tags/any(t: t eq 'news' or t eq 'sport').
JSON schemas can’t build a list inside any. If you need to match an array property against a list of values from the source entity, use a JavaScript schema.

Doesn’t contain a matching value

Doesn't contain a matching value
not in front of any also matches source entities that don’t have the array, or where it’s null or not an array.

What you can write inside any

Inside any, compare the item with eq and combine comparisons with and and or. Keep the item on the left (t eq 'news', not 'news' eq t), and put conditions on the source entity itself outside any. Otherwise the filter can match nothing, without an error.The following aren’t supported and return a validation error:
  • ne inside any. To match source entities where no item equals a value, use eq and put not in front of any.
  • in inside any. Join eq comparisons with or instead.
  • eq null inside any.
  • any inside any, and all.
  • not anywhere other than directly in front of any.
  • An any where and over or groups expands to more than 256 combinations, for example nine (a or b) groups combined with and. A plain or list isn’t limited. Reduce the number of or groups combined with and.

Common mistakes

Full example

Full example