Deploying Meilisearch
Lightweight search engine with sub-50ms search, typo tolerance, and easy API.
PlatformsIntermediate
Why
Meilisearch is a lightweight alternative to Elasticsearch — sub-50ms search, typo tolerance, and zero configuration. Written in Rust, single binary, easy to deploy.
Platform-as-a-Service adoption grew 24% in 2024 as teams shift from VM management to git-push deploys. the cloud infrastructure market reached $330B in 2024, growing 22% year-over-year (Synergy Research), and PaaS layers capture the majority of new workloads.
When
Use Meilisearch for app search where Elasticsearch is overkill. Avoid for log analytics (no aggregations).
How
1. Docker — getmeili/meilisearch with master key
2. Index — create index, add documents
3. Search — POST /search with q + filter
4. Settings — searchable attributes, ranking rules
5. Sync — webhook or cron to keep in sync with DB
6. Auth — master key for admin, search key for reads
7. Snapshot — /snapshots for backup
Example
# docker-compose.yml
services:
meili:
image: getmeili/meilisearch:v1
environment:
MEILI_MASTER_KEY: master-key
ports: ["7700:7700"]
volumes: [meilidata:/meili_data]
volumes: { meilidata: }
# Add documents and search
curl -X POST localhost:7700/indexes/movies/documents?primaryKey=id -H 'Authorization: Bearer master-key' -d '[{ "id": 1, "title": "Carol" }]'
curl -X POST localhost:7700/indexes/movies/search -H 'Authorization: Bearer search-key' -d '{ "q": "carol" }'
Common Problems
- ⚠No master key in production — Meilisearch refuses to start without it
- ⚠Index out of sync — no auto-sync with DB, set up webhook/cron
- ⚠Configuration drift between environments — use infrastructure-as-code (Terraform/Pulumi) to keep dev/staging/prod identical
Best Practices
- ✓Always set master key in production — required for security
- ✓Use search-only API key for frontend — limited to search, not admin
- ✓Set up health checks and graceful shutdown — handle SIGTERM to drain in-flight requests before exit