After our previous VectorBench post, which compared SereneDB against the Qdrant search engine, many of you asked for Elasticsearch numbers. Despite the GTA VI release, we've finished the benchmarking, so this post is for you, our vector search enthusiasts. We ran Elasticsearch 9.5.6 through the same VectorBench setup as in the previous post: the first 10 million paragraphs of Cohere's multilingual Wikipedia in RAM, then all 246,838,423 of them, 1024 floats each, on one machine with 185 GB of RAM.
Enough with the boring numbers, let's look at the colorful plots!
TL;DR
Let's start with the first 10 million vectors, all in RAM, where both engines answer from 8-bit codes without rereading anything:
| SereneDB 26.11.1 | Elasticsearch 9.5.6 | lead | |
|---|---|---|---|
| Load, disk and memorylower is better | |||
| load (ingest and index) | 12.2 min | 52.7 min | |
| on disk | 53 GB | 53 GB | |
| start to first query, files cached | 1.7 s | 14.5 s | |
| memory while querying | 12 GiB | 33–34 GiB | |
| Queries per second at recall 0.95higher is better | |||
| top-10, no filter | 8,096 | 2,991 | 2.71× |
| top-100, no filter | 6,453 | 3,621 | 1.78× |
| top-10, 10% range | 2,462 | 870 | 2.83× |
| top-100, 10% range | 2,039 | 1,068 | 1.91× |
- Load, disk and memory. SereneDB loaded them in 12.2 minutes against 52.7. Both take 53 GB on disk, and while querying SereneDB used 12 GiB of memory against 33–34.
- Without a filter SereneDB was 1.5× to 2.7× faster at every k, 2.7× on top-10 at recall 0.95. It also reaches higher recall at the top: 0.979 to 0.987 against 0.959 to 0.972.
- With a filter it was 1.6× to 4.1× faster on the 10% filters, 1.0× to 1.3× on the 1% ones, and the only one to reach recall 0.95 on the far cluster at k = 10.
- Overall SereneDB was faster in 28 of the 31 rows both engines answer. Elasticsearch was faster in 2, both on the query's own cluster, and one row was even.
That was fun, but it's time for the larger dataset:
| SereneDB 26.11.1 | Elasticsearch 9.5.6 | lead | |
|---|---|---|---|
| Load, disk and memorylower is better | |||
| load (ingest and index) | 5.7 h | 28.4 h | |
| on disk | 1.12 TB | 1.09 TB | |
| cold start to first query | 213 s | 558 s | |
| memory while querying | ~100 GB | ~94 GB | |
| Queries per second at recall 0.95higher is better | |||
| top-10, no filter | 521 | 175 | 2.98× |
| top-100, no filter | 88.0 | 27.6 | 3.19× |
| top-10, 10% range | 347 | 90.2 | 3.85× |
| top-100, 10% range | 54.5 | 15.1 | 3.61× |
- Load, disk and startup. SereneDB took 5.7 hours and Elasticsearch 28.4. On disk they end up about the same size, 1.12 TB and 1.09 TB, most of it the terabyte of float vectors both keep for reranking. From a cold start SereneDB answered its first vector query after 213 s, Elasticsearch after 558 s.
- Without a filter SereneDB was 1.1× to 3.2× faster at recall 0.90 and 0.95, at every k from 10 to 1000. It was also the only one to reach recall 0.99: Elasticsearch stops at 0.974 to 0.984.
- With a filter SereneDB was faster in 14 of the 15 rows both engines answer, by 1.4× to 25×. Elasticsearch won one, the 0.1% category at k = 10.
- Elasticsearch couldn't answer 14 filtered rows at the required recall. On every 1% filter its recall stops between 0.68 and 0.78, and its exact search on the 1% category didn't finish.
The full results are at playground.serenedb.com/vectorbench and every measured point of every curve is in the VectorBench repository.
The setup (boring part)
The method is the one from the Qdrant post, which describes it in full. In short:
- The corpus: all of Cohere's
wikipedia-2023-11-embed-multilingual-v3, 1 TB of unit-length float vectors, compared by inner product. 10,000 held-out queries in seven languages, with the exact top 1000 of every query under every filter computed by brute force. - The rows: no filter or one of ten filters (a category at 10%, 1% and 0.1%, a range at 10% and 1%, a conjunction, the query's own cluster, a far cluster, the query's language and another language), each at k = 10, 100 and 1000 and at recall 0.90, 0.95 or 0.99. That gives 39 rows. Exact unfiltered search at 247M is not run.
- How a cell is read: each engine declares a ladder of knob values per query group, every point is measured, and the table reads the engine's own Pareto frontier at the row's recall.
- The machine: one AWS c7i.24xlarge, 96 vCPUs, 185 GB of RAM and an EBS volume that gives about 560 MB/s and 10,000 IOPS.
- At 10M everything is in RAM: both engines' files are read into the page cache before the run and every point times all 10,000 queries.
- At 247M every query is timed once: each point of a group runs its own slice of the queries, the page cache is dropped and the engine's vector files are paged out before every group, and there is no warmup. 32 clients send queries concurrently.
When every point an engine measured is above a row's recall, the cell takes its cheapest point and that engine delivers more recall than the row asks for. That happens to SereneDB in 31 of the 247M cells, read at recall 0.97 to 0.996, and to Elasticsearch in 4, read at most 0.011 above the target. So it understates SereneDB far more than Elasticsearch.
How Elasticsearch was set up
We ran the official image, docker.elastic.co/elasticsearch/elasticsearch:9.5.6, as a single node with security off. It holds one index with one shard and no replicas, force-merged to 8 segments. The graph is HNSW with m = 16 and ef_construction = 256, as in SereneDB.
However, we did change some of the default settings. Let us explain why:
| Change | What it does | Why |
|---|---|---|
store.preload | Reads the graph, codes and filter files into memory when the index opens | Otherwise these files fault in from disk during the first queries of a run. With it, the 9.3 minutes of reading them count as startup, as loading does for the other engines |
| 31 GB heap, locked in memory | The largest heap that keeps compressed object pointers; the rest of the RAM stays page cache for the graph and codes | Merging the graphs of 31-million-document segments needs the room: during the 247M force-merge the heap was at 78% |
| 24 bulk workers (load only) | Sends bulk requests in parallel | The ingest runs in parallel: the 247M ingest took 12.3 hours |
Unthrottled merges with intra-merge parallelism, max_merged_segment sized for 8 segments (load only) | Lets merges use the full disk bandwidth and all cores, and lets segments grow past the 5 GB default during ingest | The 10M force-merge ran on about 75 cores, and the whole 10M load took 53 minutes. The price: merges run alongside the ingest and slow it down |
| Refresh off, asynchronous translog (load only) | No new searchable segment every second and no disk sync per bulk request while nothing searches the index | Standard for bulk loads; not measured on its own |
Quantization
Both engines walk the graph on compact codes kept in RAM. At 10M everything fits, so both use 8-bit codes and answer from them without rereading anything. SereneDB uses usq8 with sdb_ann_rescore_width set to 0; Elasticsearch uses int8_hnsw with oversample: 0.
At 247M the codes have to fit in RAM next to the graph. SereneDB uses 2-bit TurboQuant codes (tq, nb_bits = 2), about 100 GB with the graphs. We wanted the same width for Elasticsearch and couldn't have it:
- Elasticsearch 9.5.6 offers HNSW over floats or over 8-bit (
int8_hnsw), 4-bit (int4_hnsw) or 1-bit (bbq_hnsw) codes. 8-bit codes of 247 million vectors would take 253 GB and 4-bit ones 126 GB, so 1-bit BBQ is the only Elasticsearch HNSW that fits. - It's also Elasticsearch's own default. A new
dense_vectorfield of 384 dimensions or more getsbbq_hnswunless the license allowsbbq_disk. - The Lucene 10.5 underneath has a 2-bit HNSW format, but Elasticsearch's mapping doesn't expose it. Elasticsearch's 2-bit codes come only with
bbq_disk, an IVF index that needs an Enterprise license. That's what Elastic used in its own comparison with Qdrant. IVF is a different design, and belongs in the on-disk tier we plan to add.
So at 247M the codes differ, 2 bits against 1, since 1 bit was the best option available without an Enterprise license.
The index
PUT /items
{
"settings": {"index": {
"number_of_shards": 1, "number_of_replicas": 0,
"dense_vector": {"hnsw_filter_heuristic": "acorn"},
"store": {"preload": ["vex", "veb", "veq", "dvd", "kdd", "kdi", "doc", "tim", "tip"]}
}},
"mappings": {
"_source": {"excludes": ["emb"]},
"properties": {
"emb": {"type": "dense_vector", "dims": 1024, "similarity": "dot_product",
"index_options": {"type": "bbq_hnsw", "m": 16, "ef_construction": 256}},
"cat10": {"type": "keyword"}, "cat100": {"type": "keyword"}, "cat1000": {"type": "keyword"},
"cluster": {"type": "keyword"}, "lang": {"type": "keyword"}, "num": {"type": "integer"}
}
}
}
Looks complicated? Allow us to explain:
dot_productis Elasticsearch's similarity for unit-length vectors, which all of these are.keywordfor the equality fields. Elasticsearch documents term queries on keywords as faster than on numbers.numtakes ranges, so it stays an integer.hnsw_filter_heuristic: acornis already Elasticsearch's default for new indexes. We set it so that a different default can't silently change the run.store.preloadreads the graph, the codes and the filter structures into memory when the index opens. Loading them then counts as startup, as it does for the other engines: SereneDB's first vector query loads its graphs, and Qdrant loads its collection before it answers. The full vectors (.vec) stay on disk. What it changes is in the table above._sourceexcludesemb, so each vector isn't stored a second time in the document source.
The query
A query is one knn clause:
{"size": 10, "_source": false, "docvalue_fields": ["id"],
"knn": {"field": "emb", "query_vector": [...], "k": 10, "num_candidates": 2048,
"filter": {"term": {"cat100": "42"}},
"rescore_vector": {"oversample": 8}}}
- The filter sits inside the
knnclause, so it applies during the walk. A filter outside it would only remove hits after the top k were picked. _sourceis off and the id comes from doc values: like every engine here, Elasticsearch returns only ids.num_candidatesis the beam of the walk in every segment. Elasticsearch caps it at 10,000.rescore_vector.oversampledecides what is reread. Elasticsearch takes the shard's bestk × oversamplecandidates by code score and rescores them with the full vectors from disk. Its default for 1-bit codes is 3. Qdrant rereads per segment and SereneDB across segments until no candidate can still win, so the same number means different work in each engine. Each engine got its own ladder from a calibration pass.- Exact rows use a
script_scoreover the same filter, which is how Elasticsearch documents exact kNN.
10M, everything in RAM: results
The first 10 million rows are 41 GB of float vectors, so here both engines keep everything in memory and answer from 8-bit codes without rereading anything.
Load, size and startup
- Load: SereneDB ingested the 10 million rows in 5.2 minutes and merged them into 8 segments in 7.0. Elasticsearch took 25.9 minutes to ingest and 26.8 to force-merge.
- On disk both take 53 GB.
- Startup, with the files already in the page cache: SereneDB answered its first vector query after 1.7 s, Elasticsearch after 14.5 s.
- Memory while querying: 12 GiB against 33 to 34 GiB, almost all of Elasticsearch's being its 31 GB heap.
Queries
Each panel is one filter, and each point in it is one setting an engine was measured at: recall across, queries per second up, on a log scale. The line joins the engine's frontier, the settings that no other setting of the same engine beats on both. Above each panel are the queries per second read off that frontier at recall 0.95, and SereneDB's lead; "max" means the engine never got there, and the number is the best recall it did reach. The recall axis counts nines, so 0.9, 0.99 and 0.999 are equally far apart. Hover a point to see its settings.
- No filter: SereneDB is 1.5× to 2.7× faster at every k, and 4.85× on exact search, 25.2 against 5.2 queries per second. It also reaches higher recall at the top: 0.979, 0.984 and 0.987 at k = 10, 100 and 1000, against 0.959, 0.968 and 0.972 for Elasticsearch. With 8-bit codes and nothing reread, neither engine reaches 0.99.
- 10% filters: SereneDB is 1.6× to 4.1× faster.
- 0.1% category, far cluster, languages: 1.5× to 4.4× faster, and on the far cluster at k = 10 only SereneDB reaches recall 0.95.
- 1% filters: the engines are close, 1.0× to 1.3×.
- Exact search on the 1% category: 1,201 against 432 queries per second, 2.78× faster.
- Elasticsearch is faster in two rows, the query's own cluster at k = 100 and 1000, by 1.21× and 1.14×. At k = 10 SereneDB leads there, 1.25×.
247M, reranked from disk: results
All 247 million rows are 1 TB of float vectors, so they stay on disk. Both engines keep their graphs and codes in RAM and reread candidates from disk to rank them.
Load, size and startup
- Load: Elasticsearch took 12.3 hours to ingest the documents and 16.2 more to force-merge them into 8 segments. SereneDB took 2.5 and 3.2 hours.
- On disk the two are close, 1.09 TB against 1.12 TB, most of it the 1 TB of float vectors in both.
- Startup, after a restart with the page cache dropped: SereneDB answered its first vector query after 213 s and Elasticsearch after 558 s. The Elasticsearch node itself is up in about 25 s; the rest is the preload reading 63 GB of graph, codes and filter files.
- Memory while querying: the page cache fills the machine in both engines, so this is what each holds for the index: about 100 GB of graphs and codes for SereneDB; for Elasticsearch, 63 GB of preloaded graph, codes and filter files plus its 31 GB heap.
- Filters on a cold cache: unlike Qdrant, Elasticsearch never stalled on a filter. The first query of every group returned within 5 s.
Queries
The same panels as at 10M. SereneDB also measured a few settings that walk the graph without rereading anything; they aren't cells of the results table and aren't drawn here.
Dotted markers, in the unfiltered panel: one point per engine left off the frontier as an outlier, each far faster than its neighbours on the ladder. SereneDB's is at recall 0.780 and 1,638 queries per second, Elasticsearch's at 0.898 and 725.
- No filter: SereneDB is 1.1× to 3.2× faster at recall 0.90 and 0.95, and only SereneDB reaches 0.99 at any k.
- 10% filters, own cluster, languages, and the 0.1% category at k = 100 and 1000: 1.4× to 5.2× faster.
- Far cluster: 13× to 25× faster.
- Only SereneDB: every 1% filter, at every k, and the 10% filters at k = 1000.
- Exact search on the 1% category: only SereneDB answered, in about 16 minutes a query with four running at once. Elasticsearch's
script_scoregave no answer within an hour. - Elasticsearch wins one row, the 0.1% category at k = 10, 343 queries per second against 273.
Why SereneDB is faster
So, why is SereneDB faster? Because we're cool! But honestly, it's the same reason as always: fewer trips to the disk. At 247 million vectors almost all of a query's time goes to rereading candidate vectors from disk, so whoever reads less, wins. And once a filter gets in the way, what matters is who can still find the right neighbours at all. Three things make the difference.
1. Fewer disk reads, and asked for ahead
Both engines pick candidates with compact codes in RAM, then reread the best ones at full precision from disk. Elasticsearch rereads a fixed number of them, k × oversample, and with 1-bit codes that number has to be large. Its default oversample of 3 tops out at recall 0.91 on top-10, so reaching 0.95 takes 8 at k = 10 and 5 at k = 100 and 1000. That's 80 disk reads for ten answers.
Every one of those reads costs. In 8 of 10 points of the 247M run (outside the far cluster), each vector Elasticsearch reread added 2.4 to 3.3 ms to a query, whatever the k, the filter or the beam:
| Query, at recall ~0.95 | vectors reread (k × oversample) | median latency | queries per second | vectors reread per second |
|---|---|---|---|---|
| top-10, 0.1% category | 35 | 72 ms | 357 | 12,500 |
| top-10, no filter | 80 | 169 ms | 159 | 12,700 |
| top-100, no filter | 500 | 1.1 s | 27.0 | 13,500 |
| top-1000, no filter | 5,000 | 11.3 s | 2.77 | 13,900 |
The last column is the disk's read rate, close to its 10,000 IOPS. In other words, Elasticsearch's speed here is simply the disk's speed divided by k × oversample.
SereneDB doesn't reread a fixed number (re-scoring):
- Every candidate gets an error bound. Its code score plus and minus
sdb_ann_rescore_widthtimes the code's estimated error. 2-bit codes err less than 1-bit ones, so the bounds are tight. - Hopeless candidates are dropped before any read. All segments of a query share one floor, the k-th best lower bound so far, and anything whose upper bound can't reach it is never read.
- The rest are reread best-first, and the rerank stops early, at the first candidate whose upper bound can't beat the k-th exact score found so far.
- The reads go out ahead. The next eight candidates already have their reads queued with the kernel, so a query keeps several reads in flight instead of waiting for each one in turn.
That early stop is why SereneDB gets faster as it asks for more recall, while Elasticsearch can only get slower, since its extra recall costs extra reads. SereneDB's unfiltered top-10 runs at 351 queries per second with a beam of 128, 420 with 512 and 521 with 4096. A wider beam means better candidates, a higher floor and fewer reads. By our estimate that's about 20 disk reads per query, against Elasticsearch's 80.
2. No cap on candidates
Filters are where it gets interesting. On the 1% filters (the cat100 category, the 1% range and the conjunction) Elasticsearch's recall gets worse as the corpus grows:
| Corpus | Elasticsearch's recall on the 1% filters |
|---|---|
| 10M | 0.31 at num_candidates 16, 0.67 at 1,024 and 0.81 at 4,096, then a jump to 0.97 by about 4,650 |
| 247M | 0.68–0.78, at num_candidates 10,000 and oversample up to 32 |
The jump at 10M is Lucene giving up on the graph: once a filtered walk would visit more documents than the filter matches, it simply scores the matching documents. At 10M a 1% filter matches about 12,500 documents per segment, few enough for that, which is why the 1% filters are close to even there.
At 247M the same filter matches about 300,000 documents per segment, too many for that trick, so the walk runs into Elasticsearch's hard cap of 10,000 candidates. Rereading more doesn't help: raising oversample from 12 to 32 left top-10 recall at 0.769. The true neighbours just never make it into the candidates, and no amount of rescoring brings them back. The same ceiling, 0.922, stops the 10% filters at k = 1000.
SereneDB has no such cap. It plans each filtered search per segment from the index's own counts, walks the graph with the filter where that pays, and reaches recall 0.95 to 0.99 on all of these rows.
3. Walk the graph, or just score the matches
When a filter keeps very few rows, walking a graph where almost every node is rejected is a waste: it's cheaper to score the matches directly. Both engines know this trick, and the results show where each uses it:
- The 0.1% category keeps about 31,000 documents per segment. Elasticsearch reaches recall 0.93 to 0.99 there even at
num_candidates16, so it isn't walking at all. That's its best row at 247M and the one it wins: 343 queries per second at recall 0.95, against 273 for SereneDB, whose cell is read at 0.996. Ask for 0.99 and the order flips, 273 against 137. - The far cluster keeps about 20,000 documents, all roughly equally far from the query, so codes can hardly rank them. Elasticsearch's 1-bit codes need
oversample48 to 64 at k = 10 to reach 0.95: 480 to 640 disk reads per query. SereneDB scores the few matches in each segment directly and rereads only the ones that can still win, which makes it 13× to 25× faster.
Run it yourself
Everything is in the VectorBench repository: the dataset preparation, the participants with their settings and ladders, and the result files this post is drawn from.
git clone https://github.com/serenedb/vectorbench
cd vectorbench
uv venv .venv && uv pip install --python .venv/bin/python -e .
export PYTHONPATH=lib VECTORBENCH_DATA_DIR=/path/to/data
.venv/bin/python -m vectorbench.cli prepare --dataset wiki-v3-1024-247m
.venv/bin/python -m vectorbench.cli run --participant elasticsearch-hnsw --dataset wiki-v3-1024-247m --index \
--views throughput --point-queries 10=1000,100=500,1000=200 --evict --warmup 0 --settle 0 --startup-samples 1
If you know a setting that makes Elasticsearch faster here, open a PR against its participant: we'd rather measure it at its best.
Conclusion
So, who wins? On 10 million vectors in RAM, SereneDB was faster in 28 of the 31 rows both engines answer, loaded the data four times faster and used about a third of the memory. On all 247 million vectors it won 20 of the 21 rows both engines answer, by up to 25×, and reached the target recall in 17 more where Elasticsearch couldn't. It also finished loading in 5.7 hours, while Elasticsearch needed more than a day.
No magic here, just a few things SereneDB does in its vector search:
- It reranks once, across all segments, and only as far as it must. Every candidate carries an error bound from its code, and the rerank stops as soon as no remaining candidate can still win.
- It reads ahead. The vectors a query will reread are requested from the disk before they're needed, so several reads are in flight at once.
- It plans every filter per segment, with no cap on candidates. That's how even the 1% filters reach recall 0.95 on 247 million vectors.
And you don't need a separate vector database for any of it. In SereneDB an embedding is just a column, indexed next to your text and filters, and a filtered vector search is a plain SQL query. Give it a try:
docker run -d --name serenedb -p 7890:7890 serenedb/serenedb
That's the whole install, and the quick start takes it from there. If your results look different, open an issue and show us.
And if you enjoyed the post, a star on GitHub means a lot to an early-stage project like ours.
If you'd like to see more open benchmarks: