How it works
When a search query is processed, Meilisearch iterates through documents and ranking rules to find and rank the best matches. On very large datasets (millions of documents) or with broad queries, this process can take significant time. The search cutoff sets an upper bound on this processing time. If Meilisearch reaches the cutoff before finishing, it returns the results collected up to that point. These results are still ranked correctly according to the ranking rules, but the result set may not include every possible match. By default, the search cutoff isnull, meaning there is no time limit.
Check current search cutoff
Retrieve the currentsearchCutoffMs setting for an index:
null.
Set a search cutoff
Configure a maximum search time of 150 milliseconds:Reset search cutoff
Remove the search cutoff and return to the default behavior (no time limit):Choosing a cutoff value
The right cutoff value is a trade-off: lower values guarantee faster responses but increase the chance of returning incomplete results for broad queries. Higher values give Meilisearch more time to find all matches but allow occasional slow queries. As a general recommendation, avoid setting the cutoff below 500ms. This provides a good safety net against unusually long queries (including potential abuse from crafted search strings) while still giving Meilisearch enough time to return quality results for the vast majority of queries.Search cutoff vs. other performance optimizations
The search cutoff is a reactive measure that limits query time after it becomes a problem. For proactive performance improvements, consider:- Configuring searchable attributes to reduce the number of fields Meilisearch scans
- Configuring stop words to eliminate common terms from indexing
- Disabling prefix search if search-as-you-type is not needed
For the full API reference, see get search cutoff.