NoSQL databases for big data come in four main types: key-value, document, wide-column and graph. Each type is used according to the needs of the workload. Elasticsearch and Apache Solr are Lucene-based search platforms, and Elastic’s guidance positions Elasticsearch as a secondary index. Elasticsearch was not built as a system of record.
That split between storing records and finding them is the main decision, and it belongs at the design stage. Once a search cluster holds the only copy of the data, mapping changes and shard rebalancing become risks to the data itself. For how the data layer fits into cloud AI systems more broadly, see the AI in cloud overview. For how we build data layers for production systems, see our page on AI infrastructure and production SaaS.
Five Jobs That Get Filed Under “NoSQL”
One approach treats “NoSQL” as a single choice: pick a document store, index everything into it, and the search problem is solved. We would separate five jobs and give primary-record storage, wide-column writes for time-ordered data, key-value lookups, graph traversal, and inverted-index text or vector retrieval each its own engine. NoSQL systems are optimised for large data volumes, flexible data models and low latency, but they do not all put the same factors first.
Cattell’s survey of scalable data stores lists six features most NoSQL systems share. They scale throughput of simple operations horizontally across many servers. They replicate and partition data across those servers. They expose a simple call-level interface instead of a SQL binding. They use a weaker concurrency model than ACID transactions. They make efficient use of distributed indexes and RAM. And they let you add new attributes to records on the fly. “Simple operations” here means key lookups and reads or writes of one record or a few records, not complex queries or joins.
The Four NoSQL Database Types and the Access Pattern Each Serves
| Type | Data model | Access pattern it serves | Example systems |
|---|---|---|---|
| Key-value | Each item is identified by a unique key, and the value can be anything from a string to a nested structure | Insert, delete and lookup by key, scaled by spreading keys across nodes | Amazon Dynamo, memcached |
| Document | “Pointerless objects” with nested documents or lists, usually with secondary indexes | Querying indexed documents through a simple query mechanism | MongoDB, CouchDB |
| Wide-column (extensible record) | A sparse, distributed, persistent sorted map indexed by row key, column key and timestamp, as Google’s 2006 Bigtable paper defines it | Range scans over row keys, because rows are usually sharded by range, so a range query does not have to touch every node | Bigtable, Cassandra, HBase |
| Graph | Nodes (entities) and edges (relationships) whose strength or type carries meaning | Traversal from a starting set of nodes along chosen relationship types until a condition is met | Neo4j |
Time-series databases are a separate design. They store data points in timestamp order so you can see how a measurement changes over time, for example readings from weather sensors or intraday stock prices. The search index is the fifth job in the list above. It is missing from the table because a search engine serves as a secondary index, not a store.
Choosing between key-value and document stores is a separate decision for AI data-serving designs. Our article on key-value vs document database choices for AI workloads covers that decision in depth.
Which NoSQL Databases Handle Very Large Datasets
Cattell names three systems as the proof of concept that inspired many later data stores. Memcached showed that in-memory indexes can scale. Dynamo pioneered eventual consistency as a route to availability. Bigtable showed that persistent record storage could scale to thousands of nodes. Google’s Bigtable paper (OSDI 2006) describes a system designed for petabytes of data across thousands of commodity servers.
Cassandra, as described by Lakshman and Malik at LADIS 2009, is built to manage very large amounts of structured data on commodity servers, with no single point of failure and high write throughput that does not sacrifice read efficiency. Amazon’s 2007 Dynamo paper describes a key-value store behind services that only need primary-key access, such as shopping carts, session management, sales rank and product catalogues. For those services, a relational database would have limited scale and availability. The typical service-level agreement for services using Dynamo was that 99.9% of reads and writes complete within 300 ms.
On the document side, MongoDB shards documents across servers automatically. A systematic literature review credits MongoDB’s scalability for handling big data efficiently.
Is NoSQL Better than SQL for Big Data?
No, not as a general replacement. The systematic review concludes that NoSQL databases are not an alternative to SQL databases. Each has advantages in particular scenarios. Cattell’s survey also argues against both extremes in the SQL versus NoSQL scalability debate, and states plainly that no single data store is best for every use.
The same review finds that NoSQL processes large, varied data efficiently, while SQL databases are more efficient for transaction systems and spend more resources on integrity and consistency. Some relational systems also scale horizontally. Cattell describes Clustrix, which offered fully ACID SQL with automatic sharding, and Google’s Megastore layer adding cross-node transactions and a SQL-like schema to Bigtable. He saw the gap between the two camps narrowing.
A relational database is the better choice when the workload depends on multi-record transactions, integrity constraints or joins that change from one query to the next. We would decide by query shape before deciding by data volume, because “big” alone does not tell you which engine to use. The wider set of stores used for machine learning, including warehouses and vector stores, is mapped in our piece on data infrastructure for ML.
How the CAP Theorem Shapes Distributed NoSQL Stores
Gilbert and Lynch proved in 2002 that a distributed web service cannot guarantee consistency, availability and partition tolerance all at once. In their proof, consistency means atomic (linearisable) operations, availability means every request to a non-failing node gets a response, and a partition means the network may lose arbitrarily many messages. Cattell notes that NoSQL proponents cite the theorem as “two out of three” and that NoSQL systems generally give up consistency.
Brewer, revisiting the theorem, qualified that shorthand: because partitions are rare, CAP should allow full consistency and availability most of the time. When a partition is detected, the system should enter an explicit partition mode, limit some operations, and then run a recovery process that restores consistency and compensates for mistakes. Which operations to limit depends on the invariants the system has to maintain. The designer decides, invariant by invariant, whether to maintain it during partition mode.
Dynamo exposes this trade-off through tunable parameters. Each instance sets N replicas, a read quorum R and a write quorum W. Setting R + W > N gives quorum-like behaviour, and (3,2,2) was a common configuration. To stay writable during failures, Dynamo uses a “sloppy quorum” over the first N healthy nodes instead of a strict one. Extensible record stores differ in their concurrency mechanisms. Cassandra opts for weaker concurrency through MVCC, while HBase and HyperTable aim for strong consistency through locks and logging. The systematic review also notes Abadi’s refinement: when there is no partition, the trade-off is between latency and consistency.
How replicas are kept in step, synchronously or asynchronously, is its own trade-off between speed and lost updates. It is covered in our article on sync vs async replication for AI data serving.
Is Elasticsearch a Database?
Elasticsearch is a search engine, not a transactional database. Found’s article on Elasticsearch as a NoSQL store says it has no transactions in the usual sense. You cannot roll back a submitted document, and you cannot submit a group of documents and have either all or none of them indexed. The same article describes the usual deployment: a database focused on constraints, correctness and transactional updates holds the master record, which is pushed to Elasticsearch asynchronously. It also calls Elasticsearch a CP system “for a fairly weak definition of ‘consistent’”, and warns that writing to a misconfigured, split-brain cluster can lose data beyond recovery.
Durability applies to one document at a time. Elastic states that a successful response is returned only once the request has been appended to the translog, which can replay writes not yet persisted to the Lucene index. ParadeDB’s analysis agrees that acknowledged documents survive crashes, but notes that this durability does not extend beyond a single document. With no transaction boundaries, a failure can leave related writes half-applied.
The detailed failure evidence dates from Elasticsearch 1.5.0, so read it with that in mind. Kyle Kingsbury’s Jepsen analysis of Elasticsearch 1.5.0 (2015) found that it lost acknowledged documents when the network partitioned, when a single primary was isolated, when a primary paused, and when several nodes crashed at around the same time. In one run, isolating primary nodes lost almost a quarter of acknowledged documents. In a crash test, about 10% of acknowledged writes were lost. That analysis also said Elasticsearch did not fsync before acknowledging writes; Elastic’s current description says a write is acknowledged only once it is stored in the translog. The vendor’s current description is the stronger source for today’s versions, and the 2015 figures should not be read as current behaviour. The architectural point remains: Elasticsearch guarantees nothing beyond a single document.
One exception is reasonable. Found’s article says Elasticsearch can act as the primary store when its limits are not showstoppers, as with logs shipped by Logstash. Logs are written once and read many times, with no updates, transactions or integrity constraints.
Why a Search Index Should Not Be Your System of Record
The first problem is changing a mapping. ParadeDB points out that Elasticsearch index mappings are immutable once set, so changing one can mean building a new index and copying every document into it. If Elasticsearch sits downstream of a real database, that copy is painful but safe. If Elasticsearch is the only store, the whole system of record has to be moved under load, with only a restore as a fallback.
Multi-document writes cause the second problem. Writes succeed independently and possibly out of order, so a failed write within a logical group leaves half an operation applied, and teams at first add retries or reconciliation jobs to patch the gap. Found’s article adds that the entire object graph you want to search has to be denormalised before indexing. That speeds up retrieval, but it makes keeping copies consistent harder, because each change has to reach every instance. Joins, which you would expect from a system of record, are missing or only partly supported.
There is also running cost. Elasticsearch was designed for elasticity: shards drift out of balance, JVM heaps need careful tuning, reindexing uses cluster capacity, and rolling upgrades can stall traffic. That is acceptable in an index layered on top of a database. It is much harder to accept in the only copy of your data.
We would watch ingest lag and shard rebalance duration as early warnings on an over-indexed cluster, alongside p95 query latency. How the choice of data layer feeds into production reliability is covered in our piece on big data DB choices for production AI.
Checklist Before a Search Cluster Goes into Production
- Can the index be rebuilt completely from another store, without asking anyone for data?
- Do any writes need to succeed or fail together across documents? If so, they belong in the primary store.
- Is a mapping change planned as a reindex from the source, with a known window?
- Is the index fed asynchronously, with lag monitored, so that a slow search cluster cannot block transactional writes?
- Does a continuous upsert of every document from the source repair documents the index has missed?
Pairing MongoDB with a Search Index
MongoDB’s own search architecture follows this pairing. MongoDB describes mongot, the process behind MongoDB Search, as using Apache Lucene for search and vector search indexes. It builds those indexes outside the transaction commit window, using change streams to replicate changes to the source data asynchronously, so search does not disrupt transactional workloads. When the core mongod process receives a $search or $vectorSearch query, it hands the request to mongot and then processes the results like any other aggregation pipeline stage.
A team running a standalone Elasticsearch cluster can follow the same design with its own feed. Jepsen’s recommendation describes it: keep the data in a database with stronger safety guarantees and continuously upsert every document from it into Elasticsearch. A document missing for a day gets reinserted on the next run. Found’s article describes its team using PostgreSQL and ZooKeeper as “keeper of truths” that fed Elasticsearch.
Elasticsearch vs MongoDB: Which One Holds the Record?
Elasticsearch and MongoDB do different jobs. MongoDB is an operational database designed to carry transactional workloads, with search added alongside. Elasticsearch is a search engine optimised for speed and relevance, and Elastic’s own guidance positions it as a secondary index. If the question is where the authoritative copy of a customer, order or sensor record lives, the answer is a database, not the search engine. If the question is how users find those records by text, relevance or vector similarity, the search engine is. Found’s article gives write-once data such as logs as the case where running Elasticsearch alone is reasonable.
Elasticsearch, Solr or OpenSearch: How to Choose
All three engines run on Apache Lucene, which each uses to index and query text. The table compares them on licence, origin and schema handling.
| Apache Solr | Elasticsearch | OpenSearch | |
|---|---|---|---|
| Licence | Apache 2.0 | Apache 2.0 up to 7.10.2, SSPL after that, with some modules (advanced security, alerting, index management) under a proprietary licence | Apache 2.0 |
| Origin | Lucene-based search platform | Lucene-based search engine | Forked by Amazon in 2021 from Elasticsearch 7.10.2 and Kibana |
| Schema | Predefined XML or JSON schema; fields declared before ingestion | Dynamic mapping that detects new fields at index time and can produce unexpected mappings without guardrails | Inherits the Elasticsearch 7.10.2 model |
On performance, Trail of Bits’ independent assessment compared OpenSearch with Elasticsearch. It found OpenSearch 2.17.1 to be 1.6x faster on the Big5 workload and 11% faster on the Vectorsearch workload than Elasticsearch 8.15.4, using the geometric mean of query times. Those times are client-side p90 service times, which include network and serialisation overhead. That result covers two specific versions and two workloads. It is evidence about those versions, not a permanent ranking.
Our judgement is to choose in this order. First, licence: does the deployment model, such as a managed or SaaS offering, fit the terms? Licence history in this space has kept moving, so read the current terms, not the summary in this table. Second, schema discipline: Solr’s declared schema suits teams that want strict control, while dynamic mapping suits fast iteration if someone owns the guardrails. Last, a benchmark on your own query mix at the versions you will actually deploy. Whichever engine you pick, the earlier point still applies: it should be a projection of a primary store that you can rebuild.
FAQ
Is MongoDB a SQL or NoSQL Database?
MongoDB is a NoSQL document database. It stores data as JSON-like (BSON) documents and is designed for distributed deployment. It shards documents across servers automatically.
Why Is Elasticsearch so Fast at Search?
Elasticsearch uses Apache Lucene to index and query text. Documents are denormalised before indexing, so queries need no joins. The cost is extra storage and harder consistency.