Meilisearch Primary Key Error
Workaround available Self-hosted, Meilisearch Cloud Updated November 15, 2026Based on 2 user reportsHow we research
Quick answer
Meilisearch infers the primary key from the first attribute ending in id. If there is none or several, the task fails: set the primary key yourself when adding documents.
Most likely fix: Set the primary key explicitly
How to fix it
Try these in order — the most common fix is first.
1. Set the primary key explicitly
- Add documents with ?primaryKey=your_field, for example POST /indexes/movies/documents?primaryKey=movie_code
- Or create the index first with POST /indexes and a primaryKey
Did this fix it?2. Change an existing primary key
- You can't change it while documents exist
- Delete all documents, update the index primary key, then add the documents again
Did this fix it?
Symptoms
Task fails with index_primary_key_no_candidate_found or index_primary_key_multiple_candidates_found.
Why it happens
- No attribute ending in id (case-insensitive) in the first document
- Several attributes end in id
- Trying to change the primary key while documents exist
This guide also covers
- meilisearch primary key error
- index_primary_key_no_candidate_found
- index_primary_key_multiple_candidates_found
Still not working?
If Meilisearch keeps failing, you're not alone. See every Meilisearch problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usThe same problem in other apps
All not loading, error messages & connection guides →
Typesense 503 Not Ready or Lagging Error (Typesense)
Algolia 429 Too Many Requests Error (Algolia)
Other Meilisearch errors
- Meilisearch Tasks Stuck on Enqueued
- Meilisearch Indexing Slow
- Meilisearch Documents Not Showing Up
- Meilisearch Filter Not Working (Attribute Not Filterable)
- Meilisearch Invalid API Key / Missing Authorization Header
- Meilisearch Database Version Incompatible After Upgrade
- Meilisearch Disk Usage Keeps Growing / No Space Left on Device
- Meilisearch High Memory Usage