The primary key is a special field that must be present in all documents indexed by Meilisearch.
author
, title
, and price
. More importantly, each document contains a primary field consisting of the index’s primary key id
and a unique id.
title
or genre
attribute and still be successfully indexed by Meilisearch, provided it has the id
attribute.
id
and a unique document id value.
a-z
, A-Z
, 0-9
), hyphens (-
), and underscores (_
).
books
and sets reference_number
as its primary key:
books
index and sets reference_number
as that index’s primary key:
title
:
id
in a case-insensitive manner (for example, uid
, BookId
, ID
) in your first document and set it as the index’s primary key.
If Meilisearch finds multiple attributes ending with id
or cannot find a suitable attribute, it will throw an error. In both cases, the document addition process will be interrupted and no documents will be added to your index.
index_primary_key_multiple_candidates_found
id
. It can be resolved by manually setting the index’s primary key.
index_primary_key_no_candidate_found
id
. It can be resolved by manually setting the index’s primary key, or ensuring that all documents you add possess an id
attribute.
invalid_document_id
a-z A-Z 0-9
, hyphens -
, and underscores _
.
missing_document_id