meilisearch warmup - nself-org/cli GitHub Wiki
nSelf can issue representative search queries immediately after nself start brings
MeiliSearch online, populating the query-result cache before real user traffic arrives.
Warm-up is opt-in and non-blocking. It runs in a background goroutine and never delays the startup sequence. Errors are collected and surfaced only in verbose mode.
Set MEILISEARCH_WARMUP_QUERIES in your .env.local or .env.secrets to a
comma-separated list of query strings:
MEILISEARCH_WARMUP_QUERIES="users,posts,settings"Leave the variable unset (or empty) to skip warm-up entirely. That is the default.
| Variable | Default | Description |
|---|---|---|
MEILISEARCH_WARMUP_QUERIES |
(empty — warm-up disabled) | Comma-separated list of query strings issued to MeiliSearch on startup |
- After health checks pass, nSelf reads
MEILISEARCH_WARMUP_QUERIES. - When the variable is non-empty and the configured search engine is
meilisearch, a background goroutine fires the warm-up. - Each query is sent to the MeiliSearch
multi-search endpoint
(
POST /multi-search) withlimit: 1. - A 404 response (index not yet created on a fresh instance) is treated as success because the goal is request-path warm-up, not data validation.
- The goroutine times out after 10 seconds regardless of progress.
Running nself start --verbose prints a one-line summary:
MeiliSearch warm-up: 3/3 queries succeeded
Pick queries that reflect your application's most common search patterns. Two to five queries is usually sufficient:
- Core entity names your users search for most often (for example
users,posts) - Short, common prefixes that stress-test the prefix-matching path
- A wildcard or empty string if your app uses auto-complete with no initial input
Avoid queries that return millions of results — limit: 1 is used, but the query
parser still evaluates the full index.
Remove or unset MEILISEARCH_WARMUP_QUERIES:
unset MEILISEARCH_WARMUP_QUERIES
# or remove the line from .env.local