Skip to main content
Indexing is the process of adding documents to Meilisearch so they become searchable. All indexing operations are asynchronous, meaning they are added to a task queue and processed in order.

Key concepts

ConceptDescription
DocumentsJSON objects with a primary key that become searchable records
Primary keyA unique identifier for each document in an index
TasksAsynchronous operations that track the status of indexing requests
BatchesGroups of tasks processed together for efficiency

How indexing works

When you send documents to Meilisearch, the engine follows an asynchronous pipeline:
  1. Request: Your application sends documents to the Meilisearch API.
  2. 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.
  3. Processing: The engine processes the task, parsing documents, building the inverted index and other internal data structures.
  4. Searchable: Once processing completes, the documents are immediately available for search queries.
You can monitor the status of any task (enqueued, processing, succeeded, or failed) through the tasks API.

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.
All formats require that each document contains a primary key field to uniquely identify it within the index. Once indexed, documents are available for full-text search, filtering, and other search operations.

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 in id (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