Skip to content

Filters

Filters narrow search results to documents matching specific field values. Pass them as a JSON object in the filters query parameter on the search endpoint.

Match documents where a field equals a specific value:

Terminal window
curl "https://search-api-elysia-production.up.railway.app/collections/search?q=&filters=%7B%22country%22%3A%22Scotland%22%7D"
filters decoded
{ "country": "Scotland" }

Match documents where a field equals any of the given values (OR logic):

Terminal window
curl "https://search-api-elysia-production.up.railway.app/collections/search?q=&filters=%7B%22country%22%3A%5B%22Scotland%22%2C%22Wales%22%5D%7D"
filters decoded
{ "country": ["Scotland", "Wales"] }

Match documents where a boolean field is true or false:

Terminal window
curl "https://search-api-elysia-production.up.railway.app/collections/search?q=&filters=%7B%22hasImage%22%3Atrue%7D"
filters decoded
{ "hasImage": true }

Match documents where a numeric field falls within a range. Both min and max are optional:

Terminal window
curl "https://search-api-elysia-production.up.railway.app/collections/search?q=&filters=%7B%22population%22%3A%7B%22min%22%3A10000%2C%22max%22%3A500000%7D%7D"
filters decoded
{ "population": { "min": 10000, "max": 500000 } }

You can use just min or just max for open-ended ranges:

{ "elevation": { "min": 1000 } }

Multiple filters can be combined in a single object. All filters are applied with AND logic:

{
"country": "Scotland",
"hasImage": true,
"population": { "min": 5000 }
}