Content type
Any API request with a payload (--data-binary) requires a Content-Type header. Content type headers indicate the media type of the resource, helping the client process the response body correctly.
Meilisearch currently supports the following formats:
Content-Type: application/jsonfor JSONContent-Type: application/x-ndjsonfor NDJSONContent-Type: text/csvfor CSV
Content-Type: application/json.
Content encoding
TheContent-Encoding header indicates the media type is compressed by a given algorithm. Compression improves transfer speed and reduces bandwidth consumption by sending and receiving smaller payloads. The Accept-Encoding header, instead, indicates the compression algorithm the client understands.
Meilisearch supports the following compression methods:
br: uses the Brotli algorithmdeflate: uses the zlib structure with the deflate compression algorithmgzip: uses the gzip algorithm
Request compression
The code sample below uses theContent-Encoding: gzip header, indicating that the request body is compressed using the gzip algorithm:
Response compression
Meilisearch compresses a response if the request contains theAccept-Encoding header. The code sample below uses the gzip algorithm:
Search metadata
You may use an optionalMeili-Include-Metadata header when performing search and multi-search requests:
metadata object:
metadata contains the following fields:
| Field | Type | Description |
|---|---|---|
queryUid | UUID v7 | Unique identifier for the query |
indexUid | String | Index identifier |
primaryKey | String | Primary key field name, if index has a primary key |
remote | String | Remote instance name, if request targets a remote instance |
A search refers to a single HTTP search request. Every search request is assigned a
requestUid. A query UID is a combination of q and indexUid.In the context of multi-search, for any given searchUid there may be multiple queryUid values.