Installation
Quick start
[!NOTE]
topk import discovers a schema, shows the plan, and imports on confirmation — see import.
Authentication
To authenticate, run:TOPK_API_KEY environment variable and skip the topk login command.
Commands
login
To authenticate, run:TOPK_API_KEY environment variable and skip the topk login command.
logout
Remove saved credentials:import
Bulk import into TopK collections. Every run prints the plan as a TOML spec and asks before writing; collections are created right after.Import a database
<object>=<collection> renames.
Import files
Copy a TopK collection
Preview and edit the plan
[!WARNING] Keep credentials on the command line or in the environment, never in the spec — the spec is meant to go in git.
Resume a stopped run
Stop a run —^C, a lost connection — and pick it up where it left off:
--resume, a re-run re-imports everything — upserts are idempotent.
Sources
Spec
One TOML table per collection —from, id, filter/partition/limit as the flags, and a fields whitelist (only declared fields import):
Discovery takes the source’s types; declaring a different
type converts. Embeddings that arrive as float lists, text ("[1,2,3]") or packed bytes become vectors by declaring f32_vector and dim (f32_matrix and cols for multi-vectors); a sparse vector reads numeric keys or parallel indices/values lists; epoch numbers or date text become timestamp. Conversions are exact or the document fails; a narrower declaration (truncate included) is how loss is accepted.
Failures and limits
A document fails when a value does not convert exactly, its id is missing or empty, or it is over 200 KB. A failure stops the run, ready to--resume; --continue-on-error skips them instead.
- there is no schema migration: an existing collection whose schema differs is rejected
- an upsert replaces the whole document, so a spec that omits an existing field clears it
Global flags
These flags are accepted by every command:--output
Options:
text(default)json
jq.
--api-key
API key to use for this invocation. Overrides the TOPK_API_KEY environment variable and the key saved via topk login.
--region
Region to connect to (env TOPK_REGION); required by import. See https://docs.topk.io/regions.