Prompt
How do I add filters and facets to app search?
Latest observation
Oct 12, 2026
OpenAI APIWeb search: off
To add filters and facets to App Search, you usually do two things:
- Mark fields as filterable/facetable in your schema
- Send those fields in the search request as filters and/or request facet counts
1) Make sure the fields are suitable
In App Search, the fields you want to filter or facet on should be mapped as the right type when you index documents.
Typical facet/filter-friendly fields are:
textnumberdategeolocationenum/ keyword-like fields depending on your setup
Common examples:
category:"Shoes"brand:"Nike"price:99.99created_at:"2026-10-12T00:00:00Z"
2) Add filters to a search request
Filters restrict which results are returned.
Example search with filters
{
"query": "running shoes",
"filters": {
"brand": ["Nike", "Adidas"],
"price": {
"from": 50,
"to": 150
}
}
}
This means:
- only documents where
brandis Nike or Adidas - and
priceis between 50 and 150
Filter logic
- Multiple values in the same field are usually treated as OR
- Different fields are usually treated as AND
3) Add facets to return counts
Facets let you show things like:
- Brand: Nike (12), Adidas (8)
- Category: Shoes (20), Shirts (5)
Example search with facets
{
"query": "running shoes",
"facets": {
"brand": [
{
"type": "value",
"size": 10
}
],
"price": [
{
"type": "range",
"ranges": [
{ "from": 0, "to": 50 },
{ "from": 50, "to": 100 },
{ "from": 100, "to": 200 }
]
}
]
}
}
4) Combined example
{
"query": "laptop",
"filters": {
"brand": ["Dell", "Lenovo"],
"price": {
"from": 500,
"to": 1200
}
},
"facets": {
"brand": [
{ "type": "value", "size": 5 }
],
"price": [
{
"type": "range",
"ranges": [
{ "from": 0, "to": 500 },
{ "from": 500, "to": 1000 },
{ "from": 1000, "to": 1500 }
]
}
]
}
}
5) If you’re using the App Search API
You’d typically send this to the search endpoint for your engine.
cURL example
curl -X POST "https://YOUR-ENTERPRISE-SEARCH-HOST/api/as/v1/engines/YOUR_ENGINE/search" \
-H "Authorization: Bearer private-YOUR_PRIVATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "laptop",
"filters": {
"brand": ["Dell", "Lenovo"]
},
"facets": {
"brand": [{ "type": "value", "size": 5 }]
}
}'
6) UI-side usage
In your app:
- let users select filters from checkboxes, dropdowns, sliders
- convert those selections into the
filtersobject - render facet counts returned by the API
If you want, I can also show you:
- the exact App Search JSON syntax for nested filters/facets,
- examples in JavaScript / React,
- or how to do this in Elastic Enterprise Search App Search vs Elasticsearch.