Skip to main content
By default, adding an attribute to 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:
{
  "filterableAttributes": ["genre", "price", "rating", "artist"]
}
This enables all filter operations (equality, comparison, and facet search) for every listed attribute. For many projects this is fine, but it means Meilisearch builds data structures for operations you may never use.

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 more attributePatterns with a features object:
{
  "filterableAttributes": [
    {
      "attributePatterns": ["genre", "artist"],
      "features": {
        "facetSearch": true,
        "filter": {
          "equality": true,
          "comparison": false
        }
      }
    },
    {
      "attributePatterns": ["price", "rating"],
      "features": {
        "facetSearch": false,
        "filter": {
          "equality": true,
          "comparison": true
        }
      }
    }
  ]
}
In this example:
  • genre and artist support 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.
  • price and rating support 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

Use PATCH /indexes/{indexUid}/settings to apply granular filterable attributes:
curl \
  -X PATCH 'MEILISEARCH_URL/indexes/products/settings' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  --data-binary '{
    "filterableAttributes": [
      {
        "attributePatterns": ["genre", "artist"],
        "features": {
          "facetSearch": true,
          "filter": {
            "equality": true,
            "comparison": false
          }
        }
      },
      {
        "attributePatterns": ["price", "rating"],
        "features": {
          "facetSearch": false,
          "filter": {
            "equality": true,
            "comparison": true
          }
        }
      }
    ]
  }'
Meilisearch returns a summarized task object. Wait for the task to complete before querying with the new filters.

Available features

FeatureTypeDescription
facetSearchBooleanEnables facet search on the attribute. Used with the /facet-search endpoint and facet distribution.
filter.equalityBooleanEnables equality operators: =, !=, IN, NOT IN, IS NULL, IS NOT NULL, IS EMPTY, IS NOT EMPTY, EXISTS, NOT EXISTS.
filter.comparisonBooleanEnables comparison operators: >, >=, <, <=, TO.

Wildcard patterns

You can use "*" as a wildcard to set default features for all attributes, then override specific ones:
{
  "filterableAttributes": [
    {
      "attributePatterns": ["*"],
      "features": {
        "facetSearch": false,
        "filter": {
          "equality": true,
          "comparison": false
        }
      }
    },
    {
      "attributePatterns": ["price", "rating"],
      "features": {
        "facetSearch": false,
        "filter": {
          "equality": true,
          "comparison": true
        }
      }
    }
  ]
}
This sets equality-only as the default for all filterable attributes, then adds comparison support specifically for 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.
The improvement scales with the number of filterable attributes and the size of your dataset. Projects with many filterable attributes and millions of documents will see the largest gains.

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.