Document formatting
Use a simple, consistent structure
Meilisearch can handle complex nested JSON, so you don’t need to flatten everything. However, simpler structures are easier to configure and search through. The key rule is: never use dynamic field names. Every document in an index should share the same field names. If field names change from one document to the next, Meilisearch cannot index them properly. Good: consistent field names, nested objects are fine:Use meaningful primary keys
Choose a primary key that uniquely identifies each document and is stable over time. If your documents come from a database, use the database’s primary key. If Meilisearch doesn’t find a primary key candidate, it will ask you to set one explicitly.Remove unnecessary fields
If a field is not searchable, filterable, sortable, or displayed, remove it from your documents before indexing. Smaller documents are indexed faster and consume less disk and memory.Chunking content
When indexing long-form content (articles, documentation pages, books), break it into smaller, meaningful chunks rather than indexing entire pages as single documents.Why chunk
- Better relevancy: a search for “installation guide” is more likely to match a specific section than an entire 5,000-word page.
- Better displayed results: users see targeted excerpts instead of massive blocks of text.
- Faster indexing: smaller documents are processed more quickly.
How to chunk
Split content at logical boundaries like headings, sections, or paragraphs. Each chunk should be self-contained enough to make sense on its own.Batching requests
Send documents in large batches
A single large HTTP payload is processed more quickly than multiple smaller payloads. For example, indexing 100,000 documents in two batches of 50,000 is faster than four batches of 25,000. By default, Meilisearch accepts payloads up to 100MB. Enterprise accounts can request a higher limit.Use compression
Compress your HTTP payloads usinggzip, deflate, or br encoding to reduce transfer time and bandwidth. Meilisearch accepts all standard encoding formats.
Monitor task completion during large imports
When sending multiple batches, you don’t need to wait for each task to complete before sending the next one. Meilisearch queues all tasks and processes them in order. However, monitoring task status helps you detect errors early.Indexing performance
Configure settings before adding documents
Always configure your index settings (ranking rules, filterable attributes, searchable attributes) before adding documents. Changing settings after indexing triggers a full reindex of all documents.Restrict searchable attributes
By default, all fields are searchable. Limit searchable attributes to only the fields users should be able to search through. This improves both relevancy and indexing speed.Use separate indexes for separate languages
If your dataset contains content in multiple languages, create a separate index for each language. Meilisearch’s tokenizer, stop words, and ranking algorithms are language-specific, so mixing languages in a single index degrades relevancy for all of them.Avoid creating too many indexes
Each index consumes resources. If you notice performance degradation with multi-index searches, consider consolidating indexes where possible.Enable binary quantization for large AI search datasets
If you use AI-powered search with more than 1 million documents and high-dimensional embeddings (1400+ dimensions), consider enabling binary quantization. This reduces semantic search precision slightly but greatly improves indexing and search performance.Keep Meilisearch up to date
Each release includes indexing and search performance improvements. Check the changelog and GitHub releases regularly.Next steps
Configure index settings
Learn how to set up searchable, filterable, and sortable attributes
Relevancy and ranking
Understand how Meilisearch ranks search results
Working with tasks
Monitor indexing progress with the task API
Security
Secure your Meilisearch instance with API keys