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
- JavaScript
- JSON
EQUALS operator
- JavaScript
- JSON
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
- JavaScript
- JSON
AND operator
- JavaScript
- JSON
OR operator
and and or.
- JavaScript
- JSON
Group conditions with parentheses
Match a value in a list
- JavaScript
- JSON
Check whether the element exists in this collection
Arrays
Useany 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
- JavaScript
- JSON
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 theor 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
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
- JavaScript
- JSON
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
Common mistakes
Full example
- JavaScript
- JSON
Full example