Configure Meilisearch for ecommerce product search with facets, custom ranking, and filterable attributes
domain: meilisearch.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Create or update the index settings via PATCH /indexes/{uid}/settings, setting filterableAttributes to all fields you want to facet or filter on (e.g., ['brand', 'category', 'color', 'price', 'in_stock']) and sortableAttributes for fields users will sort by (e.g., ['price', 'rating']).
Add custom ranking rules to the rankingRules array after the six built-in rules; for ecommerce, common additions are 'desc(in_stock)', 'desc(rating)', or 'desc(sales_count)' — limit total rules to 8 to avoid performance degradation.
Index products via POST /indexes/{uid}/documents with an array of product JSON objects; each must include the configured uid field as the document identifier.
At search time, send POST /indexes/{uid}/search with a body including q (search term), filter (e.g., 'in_stock = true AND price < 100'), sort (['price:asc']), and facets (['brand', 'category']). The response includes hits, facetDistribution (counts per value), and totalHits.
For Meilisearch Cloud, authenticate requests with a bearer token passed in the Authorization header (Authorization: Bearer YOUR_KEY); self-hosted instances can also run without authentication for dev environments.
Known gotchas
filterableAttributes must be declared in settings before you can use a field in a filter or facet query — adding them after ingestion triggers a re-indexing task that temporarily affects performance on large catalogs.
Custom ranking rules require numeric attribute values for asc()/desc() — applying them to string attributes will not produce meaningful ordering.
Meilisearch's open-source self-hosted version has no per-query pricing, but Meilisearch Cloud bills by record count and search operations; validate pricing against your catalog size and expected query volume.
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?