Skip to content

Stop choosing. SurrealDB launch week, 12-16 October

See what's coming

SurrealDB vs.
Elasticsearch

Elasticsearch. A search cluster run beside your database.
SurrealDB. Full-text and vector search built into the database itself.
One engine. One query language, with ACID consistency across it.

01 |THE DIFFERENCE

Where Elasticsearch is synced into, SurrealDB searches the source

Elasticsearch is a search layer that data is synced into. SurrealDB makes search an index on the transactional data, so relevance, freshness and consistency come from one system.

02 |THE SAME QUERY

Similar documents, from one team, this quarter. A kNN clause over fields an ingest pipeline flattened in. One statement in SurrealQL, following the relationship itself.

Elasticsearch (Query DSL)

1// Query DSL: kNN plus filters on fields the ingest pipeline copied in
2POST /documents/_search
3{
4 "knn": { "field": "embedding", "query_vector": q,
5 "k": 10, "num_candidates": 100 },
6 "query": { "bool": { "filter": [
7 { "term": { "author_team": team } },
8 { "range": { "published": { "gte": "now-90d" } } }
9 ] } },
10 "_source": ["title"]
11}

SurrealQL

1-- SurrealQL: the similarity and the path, together
2SELECT
3 title,
4 vector::similarity::cosine(embedding, $q) AS score
5FROM document
6WHERE embedding <|10|> $q
7 AND <-authored<-person->member_of->team CONTAINS $team
8 AND published > time::now() - 90d
9ORDER BY score DESC;

03 |HOW IT COMPARES

How SurrealDB and Elasticsearch differ

A search cluster beside the primary database means an ingest pipeline to build and reconcile, and results that lag the source of truth.

Search

SurrealDB

Elasticsearch

Full-text search
Native BM25Native BM25 full-text with custom analysers and highlighting, queried in SurrealQL alongside every other data model.
Native BM25Mature BM25 full-text with analysers and highlighting - its core strength.
Vector search
Native HNSWNative HNSW vector indexes, combined with keyword scores, graph traversal, and structured predicates in one statement.
dense_vectordense_vector fields with HNSW-based kNN, queried through the search API.
Relationships
First-classRecord links and native graph traversal with typed, queryable edges - relationships are first-class.
EmulatedNo general-purpose joins or graph traversal. Nested documents, parent-child mappings, and limited ES|QL lookup joins emulate relationships, with well-known performance costs.
Consistency and freshness
Consistency and transactions
ACIDACID transactions with read-your-writes - search results always reflect committed data.
Near-real-timeNo multi-document ACID transactions. Single-document reads are realtime, but search only reflects writes after an index refresh.
Live updates
Live queriesNative live queries stream result changes to clients over WebSocket.
PollingNo push-based query subscriptions - clients poll for changes.
Operations and cost
Role in the stack
Primary databaseThe primary database. Full-text and vector search are index types on the transactional data itself - nothing to sync.
Secondary layerA secondary search layer. Data is copied in from a primary database through an ingest pipeline you build and monitor.
Architecture
One binaryMulti-model database in a single Rust binary, with compute-storage separation for distributed deployments.
JVM clusterLucene-based distributed search cluster on the JVM. Data lives in index shards that operators size, allocate, and rebalance.
Query language
SurrealQLOne SQL-like language - SurrealQL - across every model, plus SDKs, REST, WebSocket, and live queries.
Query DSL and ES|QLJSON Query DSL plus ES|QL for search and aggregations, with administration through separate REST APIs.
Operations
No shard planningSingle binary, no JVM. Runs embedded, single-node, or clustered without manual shard planning.
TuningJVM heap tuning, shard sizing, index lifecycle management, and cluster rebalancing as routine operator work.
Security and permissions
IncludedRecord-level permissions defined in the schema and enforced by the engine - included in the source-available core.
Paid tiersTLS and role-based access in the free tier; document-level and field-level security sit in paid subscription tiers.
On-prem pricing and licensing
Source-availableSource-available engine under BSL 1.1, free to self-host with every feature included. Paid support and managed cloud are optional.
TieredFree Basic tier with advanced features gated behind paid self-managed subscription tiers, priced per node and negotiated with sales.

04 |MIGRATION

Moving off Elasticsearch. Export, translate the mappings, port the queries, then cut over.

Search

Search is an index definition

Export documents with the scroll or point-in-time API and bulk-insert them; translate mappings into table and field definitions; recreate analysers and indexes; port Query DSL to SurrealQL. Most teams run both in parallel until results match, then cut over. Talk to us about a migration workshop.

-- Search is an index definition, not a second system
DEFINE ANALYZER report_text
TOKENIZERS class
FILTERS lowercase, snowball(english);
DEFINE INDEX report_search ON report
FIELDS content
FULLTEXT ANALYZER report_text BM25 HIGHLIGHTS;
DEFINE INDEX report_vectors ON report
FIELDS embedding
HNSW DIMENSION 768;

-- Hybrid retrieval: keyword relevance and vector similarity
LET $q = "credential stuffing incident reports";
LET $vec = fn::embed($q);

-- Vector
LET $vec_results = SELECT id, title,
(1 - vector::distance::knn()) as vec_score
FROM report
WHERE embedding <|10,40|> $vec;

-- BM25
LET $bm25_results = SELECT id, title, content,
search::score(1) as bm25_score
FROM report
WHERE content @1@ $q ORDER BY bm25_score DESC;

-- Re-ranking
search::rrf([$bm25_results, $vec_results], 10);

TRUSTED BY

Enterprise teams building on SurrealDB

Elasticsearch,answered

For application and product search, yes: native BM25 with custom analysers, tokenisers, filters and highlighting, defined as indexes on transactional tables, so results reflect committed writes. For petabyte-scale log analytics built around Kibana, Elasticsearch remains a strong fit.

THE PLATFORM

Everything an application and its agents know. Five surfaces, one engine.

IN PRODUCTION

Trusted at scale. Samsung, Nvidia, Verizon, Tencent, and Walmart run on SurrealDB.

14,000+

Developers building on SurrealDB Cloud

4M+

Developers building on SurrealDB worldwide

FROM THE TEAMS

SurrealDB gives us a foundation where we can unify semantic search, knowledge graphs, and AI-driven decision making without stitching together multiple systems. Collapsing responsibility into SurrealDB has become our default engineering posture.
Justin Foley

VP of Engineering, Later

GET STARTED

Evaluate SurrealDB against Elasticsearch. Full-text, vector, graph and structured data in one consistent engine.

SurrealDB

The context and memory layer for AI agents

Database. Graphs, vectors, documents and relational data in one engine, in a single ACID transaction.
Agent Memory. Connects and retrieves context wherever your data lives, every fact carrying its source.
Cloud. Fully managed, in the cloud provider and region you choose.

Explore with AI

Copyright © 2026 SurrealDB Ltd. Registered in England and Wales. Company no. 13615201

Registered address: 3rd Floor 1 Ashley Road, Altrincham, Cheshire, WA14 2DT, United Kingdom

Trading address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG, United Kingdom