Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

quickstart (dynvec)

The vector store on its own: bring up a single-node dynvec HTTP server, populate it with a few vectors, and run a similarity search.

What it demonstrates

dynvec, the vector engine that backs Dynomite's VECTOR search fields, used directly and standalone. It creates an in-memory store with one table, seeds a handful of labeled vectors, and serves an HTTP API you can query.

#![allow(unused)]
fn main() {
use dynvec::api::serve;
use dynvec::distance::Distance;
use dynvec::encoding::Codec;
use dynvec::index::HnswParams;
use dynvec::storage::{IndexAlgorithm, TableSchema, VectorStore};

let store = Arc::new(VectorStore::in_memory());
store.create_table(TableSchema {
    name: "demo".to_string(),
    dim: 3,
    codec: Codec::Int8Quantized,
    distance: Distance::Cosine,
    hnsw: HnswParams::default(),
    algorithm: IndexAlgorithm::Hnsw,
})?;
}

It listens on 127.0.0.1:21900 by default (override with DYNVEC_LISTEN).

Design decisions and trade-offs

In-memory store
VectorStore::in_memory() keeps the example dependency-free. The same API backs a persistent store when you want durability.
Int8 quantized codec
The table uses Codec::Int8Quantized, which shrinks each vector roughly four-fold versus raw f32 at a small recall cost. Choosing the codec at table-creation time is a deliberate space/accuracy trade-off exposed to the caller.
Cosine distance + HNSW
Cosine similarity over an HNSW index -- the standard combination for semantic-similarity search. The Distance and IndexAlgorithm are per-table so different tables can make different choices.
HTTP surface
The http feature exposes a REST API, which is why the run command passes --features http. Without it, the store is a library only.

Road not taken: one global vector configuration

Distance metric, codec, and index algorithm are chosen per table rather than globally. A store commonly holds vectors with different dimensionalities and accuracy needs; forcing one setting on all of them would push the trade-off onto the wrong layer. The cost is a slightly larger table schema; the benefit is that each table is tuned to its data.

When to use this pattern

When you want the vector engine without the rest of Dynomite -- to prototype an embedding search, to benchmark a codec/distance combination, or to understand what the VECTOR fields in demo_vector_text sit on top of.

Where to go next