Skip to content

Formats

Nikita Ganzikov edited this page Jan 6, 2026 · 1 revision

Formats

Bright supports multiple input formats for adding documents to indexes.

JSON Lines (jsoneachrow)

Default format. Each line contains a separate JSON object representing a document.

Example:

curl -X POST "http://localhost:3000/indexes/products/documents?format=jsoneachrow" \
  -H "Content-Type: application/json" \
  -d '{"id": "1", "name": "Widget", "price": 19.99}
{"id": "2", "name": "Gadget", "price": 29.99}
{"id": "3", "name": "Doohickey", "price": 39.99}'

MessagePack (msgpack)

Binary serialization format that is more compact and faster to parse than JSON.

Example:

# Using msgpack-cli or similar tool to encode JSON to MessagePack
echo '[{"id": "1", "name": "Widget", "price": 19.99}, {"id": "2", "name": "Gadget", "price": 29.99}]' | \
  msgpack-encode | \
  curl -X POST "http://localhost:3000/indexes/products/documents?format=msgpack" \
    -H "Content-Type: application/msgpack" \
    --data-binary @-

Usage

Specify the format using the format query parameter when adding documents:

POST /indexes/:id/documents?format=jsoneachrow
POST /indexes/:id/documents?format=msgpack

If no format is specified, jsoneachrow is used by default.

Clone this wiki locally