The feature is exposed through the
/dynamic-search-rules API routes and the dynamicSearchRules experimental flag. For readability, this documentation refers to it simply as “search rules” everywhere outside of API payloads.This is different from the search rules object used in tenant tokens, which enforces filters.When to use search rules
Search rules are a good fit whenever you know exactly which document should appear at which position for a specific query, empty state, or time window. For example, you might pin your billing help article to the top whenever users search for “invoice”, feature a seasonal landing page for “summer sale” queries during a time-limited campaign, or curate a default list of onboarding articles for users who open search with an empty query. In each case, organic ranking still decides the rest of the result set. Only the pinned documents are promoted to fixed positions. For relevancy that adapts to every query, use ranking rules or hybrid search instead.How search rules work
When a rule matches, Meilisearch:- Computes the normal organic results
- Resolves the pinned documents from the rule
- Inserts those documents at the requested positions
- Removes duplicates and returns the final result set
Key concepts
A rule combines three parts:- Conditions decide when the rule fires. Query conditions match the search string with
contains(case-insensitive substring) orisEmpty(triggered by empty queries). Time conditions activate the rule during a window between a start and end timestamp. Multiple conditions combine withAND. - Actions decide what the rule does. Pinning is the only available action today. An action targets one document via
indexUidandid, and places it at a fixedpositionin the result list. - Priority decides which rule wins when several match at once. Lower numeric values take precedence over higher ones. Omitting priority treats the rule as the lowest precedence.
description and an active flag that lets you pause a rule without deleting it.
Use cases
- Help centers and documentation: Pin a specific answer when a user’s query matches a known topic, so the most helpful article always appears first.
- E-commerce merchandising: Promote a campaign landing page or featured product during a sale window, then let the rule expire automatically when the campaign ends.
- Editorial browse states: Curate the default list users see when they open search with no query, highlighting starter content or featured collections.
- Knowledge bases: Surface operational runbooks or policy pages at the top when support-critical keywords appear, without rebuilding relevance rules.
Current scope
Search rules apply to regular search, hybrid search, federated search, and network search. They do not support:- Regex, wildcard, or numeric-pattern matching
- Activation from filters, selected facets, locale, user context, or page context
- Actions other than pinning. Boosting, demoting, and burying are planned for future releases.
Next steps
Getting started
Enable the feature and create your first rule
Pin one result for a query
Start with the most common pinning pattern
Advanced
Matching behavior, precedence, and response details
API reference
Endpoints, rule fields, and update behavior