HeatherDB

Search documentation

Loading the documentation index…

Download
HeatherDB documentation
DocumentationHTTP API

Write endpoints

Two ways to put vectors into a collection: write, which learns competitively, and bulk_load, which does not.

Both have a legacy form without the /db/{db} prefix that targets the default database. Auth for both: Basic or Bearer, root or Database(db) (legacy form: root or Database("default")). Both create the collection if it does not exist. See Overview.

POST /db/{db}/collections/{name}/write

Write vectors into the memory, with competitive learning: activation, novelty splits, address migration. Legacy: POST /collections/{name}/write.

FieldTypeNotes
vectorsarray of arraysrequired, non-empty. Each must match the database's dimension
metadataarray of JSON valuesOptional. Length must equal vectors
curl -u admin:pw -X POST \
  http://localhost:6380/db/movies/collections/taste/write \
  -H 'Content-Type: application/json' \
  -d '{"vectors":[[0.1,0.2,0.3],[0.4,0.1,0.9]],
       "metadata":[{"title":"Solaris"},{"title":"Stalker"}]}'

Without metadata the vectors are written as one batch (a single LMDB transaction) and the response is just a count:

{ "count": 2 }

With metadata each vector also becomes a retrievable document, written one at a time, and the response carries the assigned ids:

{ "count": 2, "ids": [17, 18] }
StatusCause
400 Bad Requestempty vectors, a dimension mismatch, a metadata/vectors length mismatch, or metadata that will not serialise as JSON
413 Payload Too Largebody over --max-body-size (default 2 MiB)
500 Internal Server Errorthe collection could not be opened, or a storage failure

POST /db/{db}/collections/{name}/bulk_load

Replace a collection's hard locations atomically with a caller-supplied set. Bypasses competitive learning entirely: no activation, no novelty splits, no address migration. This is what makes snapshot algebra operate on known operands. Legacy: POST /collections/{name}/bulk_load.

FieldTypeNotes
addressesarray of arraysrequired, non-empty. Each of length d
countersarray of arraysrequired. Same length as addresses, each of length d
write_countsarray of floatsOptional. Same length as addresses. Defaults to 1.0 each
curl -u admin:pw -X POST \
  http://localhost:6380/db/movies/collections/codebook/bulk_load \
  -H 'Content-Type: application/json' \
  -d '{"addresses":[[1.0,0.0,0.0],[0.0,1.0,0.0]],
       "counters":[[0.5,0.5,0.0],[0.0,0.5,0.5]],
       "write_counts":[10.0,3.0]}'
{ "n_loaded": 4096, "dim": 128 }

The collection's existing config (dimension, EAM knobs) is preserved. The replace is version-checked: if a concurrent write lands first, nothing is changed — retry.

StatusCause
400 Bad Requestempty addresses; counters or write_counts a different length from addresses; a row whose length is not d; addresses over --max-bulk-items (default 100 000)
409 Conflicta concurrent write bumped the collection version — retryable
413 Payload Too Largebody over --max-body-size
500 Internal Server Errorthe collection could not be opened, or a storage failure