filterableAttributes enables every filter feature for that attribute: equality checks, comparison operators, and facet search. Granular filterable attributes let you enable only the features each attribute actually needs, reducing indexing time and memory usage.
The default approach
The standard way to configure filterable attributes is a flat array:Granular configuration with attributePatterns
Instead of a simple array, you can pass an object that specifies exactly which features each attribute supports. Each entry pairs one or moreattributePatterns with a features object:
genreandartistsupport facet search and equality filters (genre = "Rock"), but not comparison operators. Genres and artist names are categorical values, so greater-than or less-than comparisons are meaningless.priceandratingsupport equality and comparison filters (price > 10,rating >= 4), but not facet search. Numeric ranges are better served by comparison operators than by listing every possible value in a facet sidebar.
Complete example
UsePATCH /indexes/{indexUid}/settings to apply granular filterable attributes:
Available features
| Feature | Type | Description |
|---|---|---|
facetSearch | Boolean | Enables facet search on the attribute. Used with the /facet-search endpoint and facet distribution. |
filter.equality | Boolean | Enables equality operators: =, !=, IN, NOT IN, IS NULL, IS NOT NULL, IS EMPTY, IS NOT EMPTY, EXISTS, NOT EXISTS. |
filter.comparison | Boolean | Enables comparison operators: >, >=, <, <=, TO. |
Wildcard patterns
You can use"*" as a wildcard to set default features for all attributes, then override specific ones:
price and rating.
Performance benefits
Each enabled filter feature requires Meilisearch to build and maintain additional internal data structures during indexing. Disabling features you do not use has two benefits:- Faster indexing: fewer data structures to build means documents are indexed more quickly.
- Lower memory usage: Meilisearch stores only the structures it needs, reducing RAM consumption for large datasets.
Backward compatibility
The simple array format continues to work. You can mix both formats across different settings updates. If you switch from the granular format back to the simple array, all filter features are re-enabled for every listed attribute.Next steps
Filter expression syntax
Learn the full syntax for building filter expressions.
Search with facets
Build faceted search interfaces with filter distributions.
Sort results
Sort search results by one or more attributes.