1---2name: meilisearch3description: Deploy and tune Meilisearch with indexing, filtering, and production configuration.4---5
6## Index Configuration Traps
7- filterableAttributes and sortableAttributes must be declared BEFORE adding documents — adding later triggers full reindex
8- Changing any index setting triggers reindex — batch all setting changes together
9- Order of searchableAttributes affects ranking — put most important fields first, not alphabetical
10- displayedAttributes defaults to all — explicitly limit to reduce response size
11
12## Indexing Pitfalls
13- Document updates are async — the API returns taskUid, must poll /tasks/{uid} for actual completion
14- Primary key inference fails on nested or array fields — always set primaryKey explicitly
15- Batch size affects indexing speed — 10-50MB batches optimal, not one document at a time
16- Updating one field requires sending the whole document — no true partial updates
17
18## Typo Tolerance Issues
19- First character is never typo-tolerant — "tset" won't match "test", by design
20- Typo tolerance on IDs/codes causes false matches — disable per attribute with typoTolerance.disableOnAttributes
21- Min word length defaults: 1 typo at 5 chars, 2 typos at 9 chars — adjust if matching too aggressively
22
23## Filtering Mistakes
24- Filters on undeclared filterableAttributes silently return empty — no error, just no results
25- Geo filtering requires _geo field with lat/lng — field name is hardcoded, can't customize
26- Filter syntax is NOT SQL — use `TO` for ranges (`year 2020 TO 2024`), not `BETWEEN`
27- Empty array in IN clause causes error — check array length before building filter
28
29## Search Behavior
30- Default limit is 20, max is 1000 per request — no deep pagination, use filters to narrow
31- Multi-word queries match ANY word by default — use quotes for phrase matching
32- Highlighting only works on searchableAttributes — not on stored-only fields
33- Facets distribution counts include all matching docs — not affected by limit parameter
34
35## Production Configuration
36- Master key MUST be set in production — without it, all endpoints are public
37- Create search-only API keys for frontend — never expose master key
38- Snapshots are the only backup method — schedule them, no continuous replication
39- No clustering — single node only, scale vertically with RAM
40
41## Performance Realities
42- Index lives in memory-mapped files — RAM determines max index size
43- Payload limit is 100MB per request — split large imports into batches
44- Indexing blocks during settings update — queries still work but new docs queue
45- Task queue has no priority — large reindex blocks small document adds
46
47## API Key Restrictions
48- Keys can restrict to specific indexes — use for multi-tenant isolation
49- Keys can have expiresAt — but no auto-rotation, must manage manually
50- Actions are granular — search, documents.add, indexes.create, settings.update, etc.
51- Invalid key returns 401, missing key on protected instance returns 401 — same error, check both