18

Is Elasticsearch a database itself? Is it safe to use it as my primary database? Is it secure as my primary database to store sensitive data?

VLAZ
  • 26,331
  • 9
  • 49
  • 67
aditya76
  • 189
  • 1
  • 1
  • 7

4 Answers4

17

Elasticsearch is a standalone database. Its main use case is for searching text and text and/number related queries such as aggregations. Generally, it's not recommended to use Elasticsearch as the main database, as some operations such as indexing (inserting values) are more expensive compared to other databases.

You can use Elasticsearch along with any other database such as MongoDB or MySQL, where the other databases can act as the primary database, and you can sync Elasticsearch with your primary database for the "searchable" parts of the data.

Elasticsearch works well with a number of other products from Elastic such as Logstash for logging purposes and Kibana for visualization purposes.

Elasticsearch homepage has a well-written description of it and its main use cases.

Behrooz
  • 2,181
  • 1
  • 16
  • 24
4

You might want to look at below link to understand Elasticsearch's usefulness as a database and what tradeoffs you have make in order to use it as a primary database

https://www.elastic.co/blog/found-elasticsearch-as-nosql

In general, Elasticsearch has been primarily used as an index store for retrieving/searching data really fast. Elasticsearch is powered by Lucene which is a high performance , text search engine library , which makes it a very powerful tool to provide an on top full-text search platform for applications. But it is usually recommended that your "source of truth" database is separate from Elasticsearch index data itself and also because nature of its primary operation ( full-text search ) it has not focussed on other aspects of database such as durability , security and write consistency etc. Hope this helps.

fatcook
  • 946
  • 4
  • 16
3

This question is from 2018, and at that time I would have probably answer with a definitive No - don't use Elasticsearch as your only and primary database.

But since ~2015 a lot of resiliency issues have been found and addressed, and in recent years a lot of features and specifically stability and resiliency features have been added, that it's definitely something to consider given the right use-cases and leveraging the right features in the right way.

synhershko
  • 4,472
  • 1
  • 30
  • 37
2

I used ELK stack only one time to monitor the log file from an application. The 'database' used is Elasticsearch. And it does seem as though it is positioned to be a primary database that is also "Open source and free to use."

Elasticsearch is a distributed, RESTful search and analytics engine capable of solving a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data so you can discover the expected and uncover the unexpected.

My understanding is that the entire ELK stack is comprised of three tools. Namely it is ELK Stack: Elasticsearch, Logstash, Kibana. Where Elasticsearch is a search and analytics engine. Logstash is a server‑side data processing pipeline that ingests data from multiple sources simultaneously, transforms it, and then sends it to a "stash" like Elasticsearch. Kibana lets users visualize data with charts and graphs in Elasticsearch. That's from their site at: https://www.elastic.co/elk-stack

I am curious what others have to say and will have to follow your question. I currently work with Oracle and SQL Server for our application and would like to see how we could leverage additional database software in the future. Open source is always intriguing.

MrStoner
  • 21
  • 1