Query Guide

Vector Search

Search by meaning, not just keywords. Liven stores and searches int8 quantized vectors natively.

Storing Vectors

Liven has a native Vector data type that stores int8 quantized embeddings compactly. Insert vectors like any other value:

from("embeddings").insert("doc_101", [12, -45, 98, -128, 127])

Vectors are stored as raw i8 slices on disk and in memory — no MessagePack serialization overhead. This makes them ~4x faster to read than arrays encoded in MessagePack.

Storing Vectors in Structured Records

You can embed vectors as fields inside structured records for richer queries:

from("documents").insert("doc_102", {
text: "Hello LIVEN",
embedding: [12, -45, 98]
})

Searching with vector_filter()

Use the vector_filter() stage to filter records by cosine similarity against a query vector:

from("embeddings") | vector_filter(value, [10, -20, 30], 0.85)

This returns records where the cosine similarity between the stored vector and the query vector is ≥ 0.85.

Parameters

  • field — the field containing the vector (e.g., value, embedding)
  • query_vector — the vector to compare against (int8 values)
  • threshold — minimum similarity score (0.0 to 1.0)

Filtering on Embedded Fields

from("documents") | vector_filter(embedding, [12, -45, 98], 0.8)

Real-Time Vector Search

Combine vector search with live subscriptions for real-time semantic monitoring:

from("embeddings") | vector_filter(value, [12, -45, 98], 0.85) .listen()

This streams all new embeddings that are semantically similar to the query vector as they are inserted.