Skip to main content
Your summer sale runs from June 1 to June 30. During that month, you want every product on sale to rank higher than the rest, whatever users type. Pinning is too rigid here: you do not know in advance which products users will search for, and you do not want a fixed list at the top of every result page. Boosting keeps the results organic and only pushes the selected products up. One rule covers the whole campaign: a time condition for the period, and a boost action for the products on sale.

Set up from the Meilisearch Cloud dashboard

Open your project in the Meilisearch Cloud dashboard, select the Search rules tab, and click New rule. Give the rule an ID, such as summer-sale, and a description.

Boost the products on sale

In the Actions block, click Add action, select Boost documents, then click Next. Choose how to select the products: with a filter, or document by document. A filter fits here, because you want every product on sale, whichever they are at that moment. Dialog asking whether to select documents with a filter or by hand Pick Use a filter, then fill in the dialog:
  • Index: the index holding the products, here products.
  • Filter: the condition selecting them, here on_sale = true. The attribute you filter on must be in the filterableAttributes setting of the index, otherwise the action selects no document.
  • Strength: how high the selected products climb. Start with the medium value, then run a few searches of your own and adjust: the right strength depends on your data and on the way your users search.
The dialog tells you how many documents the action affects, so you can check your filter before saving. Click Add action. Boost documents dialog with the index, the strength, and the filter

Limit the rule to the campaign

In the Conditions block, set Time to Apply within time range, then enter the start and the end of your campaign. Times are in UTC, so convert your local window before entering it. Actions block with the boost action, and the time range condition Click Create rule. Meilisearch indexes the rule, which can take a few seconds to a few minutes. Once it is live, searches keep their usual results during the campaign, with the products on sale higher in the list.

Set up on a self-hosted instance

Search rules must be turned on before you call the /dynamic-search-rules routes, otherwise Meilisearch returns an error. See Create your first rule.
  • weight multiplies the relevancy of the selected documents. Above 1, the documents rank higher. A product that was tenth can move into the first results, but only if it matches the query.
  • filter selects every document matching it. The attributes you use must be in the filterableAttributes setting of the index, otherwise the action selects nothing.
  • conditions.time accepts RFC 3339 timestamps in UTC. Convert your local campaign window before sending it.
Meilisearch answers with a summarized task containing a taskUid, because creating a rule is an asynchronous operation:
The rule applies to searches once this task reaches the succeeded status. To follow its progress, pass the taskUid to the task API. From then on, searches return the same documents as before, with the products on sale higher in the list. At the end of the campaign, the rule stops on its own and the ranking goes back to normal, with nothing to clean up.

Next steps

Deboost documents

Keep documents available but lower in the results

Hide documents

Remove documents from the results without reindexing

Pause a rule

Stop a campaign before its end date

API reference

Endpoints, rule fields, and update behavior