The /documents route allows you to create, manage, and delete documents.
/documents
route allows you to create, manage, and delete documents.
Learn more about documents.
offset
and limit
to browse through documents.
filter
will not work without first explicitly adding attributes to the filterableAttributes
list. Learn more about filters in our dedicated guide.Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
Name | Type | Default Value | Description |
---|---|---|---|
offset | Integer | 0 | Number of documents to skip |
limit | Integer | 20 | Number of documents to return |
fields | Array of strings/null | * | Document attributes to show (case-sensitive, comma-separated) |
filter | String/Array of array of strings/null | N/A | Refine results based on attributes in the filterableAttributes list |
retrieveVectors | Boolean | false | Return document vector data with search result |
ids | Array of primary keys | null | Return documents based on their primary keys |
--data-binary '{}'
) will return all documents in the index.Name | Type | Description |
---|---|---|
results | Array | An array of documents |
offset | Integer | Number of documents skipped |
limit | Integer | Number of documents returned |
total | Integer | Total number of documents in the index |
/indexes/{index_uid}/documents/fetch
and /indexes/{index_uid}/documents
responses do not return documents following the order of their primary keys.200 Ok
/indexes/{index_uid}/documents/fetch
instead.offset
and limit
, you can browse through all your documents.filter
must be a string. To create filter expressions use AND
or OR
.
filter
will not work without first explicitly adding attributes to the filterableAttributes
list. Learn more about filters in our dedicated guide.Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
Query Parameter | Default Value | Description |
---|---|---|
offset | 0 | Number of documents to skip |
limit | 20 | Number of documents to return |
fields | * | Document attributes to show (case-sensitive, comma-separated) |
filter | N/A | Refine results based on attributes in the filterableAttributes list |
retrieveVectors | false | Return document vector data with search result |
ids | null | Return documents based on their primary keys |
Name | Type | Description |
---|---|---|
results | Array | An array of documents |
offset | Integer | Number of documents skipped |
limit | Integer | Number of documents returned |
total | Integer | Total number of documents in the index |
/indexes/{index_uid}/documents/fetch
and /indexes/{index_uid}/documents
responses do not return documents following the order of their primary keys.200 Ok
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
document_id * | String/Integer | Document id of the requested document |
Query Parameter | Default Value | Description |
---|---|---|
fields | * | Document attributes to show (case-sensitive, comma-separated) |
retrieveVectors | false | Return document vector data with search result |
200 Ok
application/json
application/x-ndjson
text/csv
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
Query Parameter | Default Value | Description |
---|---|---|
primaryKey | null | Primary key of the index |
csvDelimiter | "," | Configure the character separating CSV fields. Must be a string containing one ASCII character. |
csvDelimiter
and sending data with a content type other than CSV will cause Meilisearch to throw an error.primaryKey
parameter will be ignored if given.
_vectors
_vectors
is a special document attribute containing an object with vector embeddings for AI-powered search.
Each key of the _vectors
object must be the name of a configured embedder and correspond to a nested object with two fields, embeddings
and regenerate
:
embeddings
is an optional field. It must be an array of numbers representing a single embedding for that document. It may also be an array of arrays of numbers representing multiple embeddings for that document. embeddings
defaults to null
.
regenerate
is a mandatory field. It must be a Boolean value. If regenerate
is true
, Meilisearch automatically generates embeddings for that document immediately and every time the document is updated. If regenerate
is false
, Meilisearch keeps the last value of the embeddings on document updates.
You may also use an array shorthand to add embeddings to a document:
_vectors
is empty or null
, Meilisearch treats the document as not having any embeddings for that embedder. This document is then returned last during AI-powered searches.202 Accepted
taskUid
to get more details on the status of the task.
application/json
application/x-ndjson
text/csv
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
Query Parameter | Default Value | Description |
---|---|---|
primaryKey | null | Primary key of the documents |
csvDelimiter | "," | Configure the character separating CSV fields. Must be a string containing one ASCII character. |
csvDelimiter
and sending data with a content type other than CSV will cause Meilisearch to throw an error.id: 287947
. This route will update the title
field as it changed from Shazam
to Shazam ⚡️
and add the new genres
field to that document. The rest of the document will remain unchanged.
202 Accepted
taskUid
to get more details on the status of the task.
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
Query Parameter | Default Value | Description |
---|---|---|
function | null | A string containing a RHAI function |
filter | null | A string containing a filter expression |
context | null | An object with data Meilisearch should make available for the editing function |
function
function
must be a string with a RHAI function that Meilisearch will apply to all selected documents. By default this function has access to a single variable, doc
, representing the document you are currently editing. This is a required field.
filter
filter
must be a string containing a filter expression. Use filter
when you want only to apply function
to a subset of the documents in your database.
context
context
to pass data to the function
scope. By default a function only has access to the document it is editing.
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
202 Accepted
taskUid
to get more details on the status of the task.
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
document_id * | String/Integer | Document id of the requested document |
202 Accepted
taskUid
to get more details on the status of the task.
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
filter
will not work without first explicitly adding attributes to the filterableAttributes
list. Learn more about filters in our dedicated guide.--data-binary '{}'
) will return a bad_request
error.202 Accepted
taskUid
to get more details on the status of the task.
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
202 Accepted
taskUid
to get more details on the status of the task.