Vector Engines
🎓 Learn how it works with the Amazon S3 Vectors with Spice engineering blog post.
Data sourced by Data Connectors, or views built atop them with vector embedding columns can be indexed and efficiently searched using a vector engine.
A vector engine will store all vector embeddings associated with columns in a dataset/view, provide efficient vector search operations and avoid unnecessary recomputation of embeddings.
A vector engine is configured by setting the vectors configuration. E.g.
datasets:
- name: dataset_with_embeddings
vectors:
enabled: true
For the complete reference specification see datasets.
Supported Vector engines:
| Name | Description |
|---|---|
s3_vectors | AWS S3 vectors |
elasticsearch | Elasticsearch (Spice.ai Enterprise) |
duckdb | DuckDB VSS (HNSW) extension |
Choosing an engine
The engines differ in where the index lives:
- External engines, for high-QPS serving where the index lives outside the Spice process and survives a restart of it. S3 Vectors stores vectors in S3 and pushes predicates on columns marked
metadata.vectors: filterableinto the index query. Elasticsearch keeps the kNN index in the cluster (and can combine it with full-text in that cluster). - In-process HNSW (DuckDB VSS) when the dataset is already DuckDB-accelerated and modest in size. The index lives in the DuckDB file. A full refresh rebuilds it. Plan memory for the graph and a cold start that reopens or rebuilds it.
Add vector search only when semantic retrieval is required. Hybrid retrieval (rrf over vector_search and text_search) is for queries that need both semantic and literal matches. Otherwise stay on SQL, regex, or full-text search. See Where indexes are built.
- A dataset or view must be accelerated (i.e.
datasets[].acceleration.enabled: true, see docs) for a vector engine to be provided the appropriate data to ingest.
Vector Engine Docs
Amazon S3 Vectors
Amazon S3 Vectors Engine Documentation
Elasticsearch
Use Elasticsearch as a vector engine in Spice for kNN vector search, full-text search, and hybrid search.
DuckDB
Use DuckDB as a vector engine in Spice for HNSW-based vector search via the DuckDB VSS extension.
