Stop calling Elastic a database already.

The ship has sailed, folks, time to swallow your pride and get with the program.

See, Elastic is really popular and for good reason. Its blazing fast full text queries are amazing. The other members of the ELK stack are also really good at what they do. This popularity, coupled with a lot of bad information online, has lead to the misconception that Elastic is a DBMS.

So, I decided to write a post detailing why that’s just plain wrong.

The reason that many people believe it is a database are because, well, it behaves like one! You insert data, you query data, it’s really that simple, right?

Wrong. You insert and query from MS Excel, or a CSV formatted .txt file too. And while that TECHNICALLY counts as a datastore, it is by no means a database management system. You can’t handle concurrent writes. It’s not transactional or atomic.

Which brings us back to Elastic. Elastic is a search engine.Elastic was built originally only as a search engine. A search engine needs data to search. Therefore, you must ingest data into Elastic shards in order to search it. There is a reason that data in Elastic is written to INDEXES. Elastic is a search engine that indexes and then stores indexed data. The fact that once ingested your data exists and is searchable does not make the primary purpose of the tool a DBMS. Sure, it can be used (or abused) as a DBMS, but most places advise against doing that, for a few reasons (in no particular order).

One, inserts are slow compared to a standard SQL or document database.

Two, data loss can technically occur within normal use. I quote: “Elasticsearch puts indexing requests in the Indexing Request Queue. When that overflows, ES will reject indexing requests and lose data.” This is why elastic is often used with a tool such as Kafka. More on this can be found here.

Three, Elastic can’t handle constraints or the like. It’s not supposed to.

Again, there is a reason that most systems store their data in a DB such as Postgres or Mongo, and duplicate the data to elastic for querying. Elastic (and Solr) is the king of complex full text search, and that’s what it should be used for.

To sum it up, let’s take a look at some screenshots from the Elastic website and DB-Engines:

From the official elastic website
DB-Engines search results (secondary model is document database)

Elasticsearch is not a Database.

I rest my case.

Devops DBA. This blog chronicles my “gotcha” moments — Each post contains an answer I would have like to have found when searching for those pesky errors I get.