Key concepts
| Concept | Description |
|---|---|
| Documents | JSON objects with a primary key that become searchable records |
| Primary key | A unique identifier for each document in an index |
| Tasks | Asynchronous operations that track the status of indexing requests |
| Batches | Groups of tasks processed together for efficiency |
How indexing works
When you send documents to Meilisearch, the engine follows an asynchronous pipeline:- Request: Your application sends documents to the Meilisearch API.
- Task queue: Meilisearch creates a task and places it in a FIFO queue. The API immediately returns a task ID so you can track progress.
- Processing: The engine processes the task, parsing documents, building the inverted index and other internal data structures.
- Searchable: Once processing completes, the documents are immediately available for search queries.
Document formats
Meilisearch accepts documents in three formats:- JSON: Arrays of objects. The most common format for API integrations.
- NDJSON (Newline-Delimited JSON): One JSON object per line. Ideal for streaming large datasets without loading everything into memory.
- CSV: Comma-separated values with a header row. Useful for importing data from spreadsheets or database exports.
Primary key
Every document in a Meilisearch index must have a unique primary key field. If you do not specify a primary key when creating an index, Meilisearch attempts to auto-detect it by looking for an attribute ending inid (such as id, movieId, or product_id). You can also set the primary key explicitly when adding documents or through the index settings.
Cross-index relationships (experimental)
Foreign keys allow you to link documents across indexes. Instead of duplicating data, you store related information in a separate index and reference it by ID. At search time, Meilisearch automatically hydrates results with the full referenced documents. See Link indexes for a step-by-step guide.Operational tools
Meilisearch includes several endpoints for managing indexes and migrating data:- Export: Transfer data directly from one instance to another over the network, without creating intermediate files. See Export data to another instance.
- Compact: Reclaim disk space by reorganizing an index’s internal data structures after bulk updates or deletions. See Compact an index.
Next steps
Getting started
Add your first documents and verify they are indexed
Monitor tasks
Track the status of indexing operations
Best practices
Optimize your indexing workflow for production
Async operations
Deep dive into the task lifecycle and queue