Skip to main content

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/json for JSON
  • Content-Type: application/x-ndjson for NDJSON
  • Content-Type: text/csv for CSV
Only the add documents and update documents endpoints accept NDJSON and CSV. For all others, use Content-Type: application/json.

Content encoding

The Content-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 algorithm
  • deflate: uses the zlib structure with the deflate compression algorithm
  • gzip: uses the gzip algorithm

Request compression

The code sample below uses the Content-Encoding: gzip header, indicating that the request body is compressed using the gzip algorithm:

Response compression

Meilisearch compresses a response if the request contains the Accept-Encoding header. The code sample below uses the gzip algorithm:

Search metadata

You may use an optional Meili-Include-Metadata header when performing search and multi-search requests:
Meilisearch Cloud includes this header by default. Responses will include a metadata object:
metadata contains the following fields:
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.