Barrel Vector
The vector layer. High-performance single-node vector search built in Erlang. Use it inside the full Barrel, or standalone as an embeddable library.
Choose Your Backend
Four indexing backends, one API. Pick the right one for your workload.
HNSW
Pure Erlang implementation. Best for most use cases.
- + Fast search <5ms
- + No dependencies
- + Good recall
FAISS
Meta's library via NIF. Best for large scale + GPU.
- + GPU acceleration
- + Billion-scale
- + IVF, PQ compression
DiskANN
Pure Erlang SSD-optimized index. Best for large datasets on disk.
- + SSD-optimized
- + Low memory footprint
- + No dependencies
BM25
Pure Erlang full-text search. Combine with vectors for hybrid.
- + Full-text search
- + Hybrid with RRF
- + No dependencies
Hybrid Search
Combine vector + BM25 with RRF fusion for best results
Multiple Metrics
Cosine, Euclidean, Dot Product distance
Metadata Filtering
Filter vectors by arbitrary JSON metadata
Persistence
RocksDB-backed storage with crash recovery
HTTP API
Simple REST interface for all operations
Embeddable
Use as a library in Erlang/Elixir apps
Performance
<5ms
Search (p99, top-10)
10K/sec
Insert throughput
1K QPS
Search throughput
Benchmarked on 1M vectors, 1536 dimensions
Quick Start
%% Start the vector store
{ok, _} = barrel_vectordb:start_link(#{name => docs, dimension => 3}).
%% Add a vector with metadata (or configure an embedder for text)
ok = barrel_vectordb:add(docs, <<"doc1">>, [0.1, 0.2, 0.3],
#{title => <<"Hello">>}).
%% Vector search
{ok, Hits} = barrel_vectordb:search_vector(docs, [0.15, 0.25, 0.35], #{k => 10}).
%% Hybrid vector + BM25
{ok, Hits2} = barrel_vectordb:search_hybrid(docs, <<"hello">>, #{k => 10}). # Reach the vector layer over HTTP by running barrel_server.
$ curl -X POST localhost:8080/db/docs/vector \
-H 'content-type: application/json' \
-d '{"id":"doc1","text":"Hello","vector":[0.1,0.2,0.3]}'
# Vector search.
$ curl -X POST localhost:8080/db/docs/search/vector \
-H 'content-type: application/json' -d '{"vector":[0.15,0.25,0.35],"k":10}'
# Hybrid vector + BM25.
$ curl -X POST localhost:8080/db/docs/search/hybrid \
-H 'content-type: application/json' -d '{"query":"hello","k":10}' When to Use
Use Barrel Vector when:
- + Single machine deployment
- + <10M vectors
- + Simple setup preferred
- + Embedded in Erlang/Elixir app
Consider alternatives when:
- + Need distributed cluster
- + >10M vectors
- + Automatic failover required
- + Horizontal scaling needed