Meilisearch Primary Key Error

Share
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. 1. Set the primary key explicitly

    1. Add documents with ?primaryKey=your_field, for example POST /indexes/movies/documents?primaryKey=movie_code
    2. Or create the index first with POST /indexes and a primaryKey
    Did this fix it?
  2. 2. Change an existing primary key

    1. You can't change it while documents exist
    2. 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 us
Fixed it? Share this guide

The same problem in other apps

All not loading, error messages & connection guides →

Other Meilisearch errors

All 11 Meilisearch errors and fixes →