Using ElasticSearch as the primary and only storage for some of my tables

I am creating an online shopping website.

customers post their products on this website. product table can fields that needs to be searched, such as product title, product description, product category, product location, etc...

I want to use ElasticSearch to store product table, so users can search the products.

all of my data is stored in a MySQL database, for example, I have Users Table, Product table, Message Table, etc...

Out of all these tables, only product table need to be search and it is the only table which needs to stored in ElasticSearch.

Now, I am not sure which is the best approach for implementing this:

  1. Is it better to store all the data including Product table in MySQL and then duplicate the Product table into ElasticSearch, so it can be searched... using for example go-mysql-elasticsearch?

  2. Instead of duplicating the product table, can I just store the Product table in ElasticSearch? this seems simple and there is no need to sync the data...

I am not sure how reliable is option 2? If I store the data in MySQL, I know I can frequently back it up... another important question is using MySQL, I can get a backup of Production DB and restore it on Test Server... If I have a production ES server and a Test ES server, can I still do a backup and restore from prod to test?

I would appreciate any recommendation.

Either of those options work, and its up to you to decide whether or not keeping your different database environments in-sync is worth the effort. As for backing up between Prod and Test, yes you absolutely can. All you need is a shared file system that both environments have access to where you can put the backup in the interim. Depending on what version of Elasticsearch your running setting up the connection to the SFS will either require more work or less, the most recent version of ELS having by far the simplest method to connect. Personally I use s3 to back up my critical Elasticsearch indices daily. For other indices I have backups on sql server. So it really depends, but I would think if you had a UAT environment as well with a current set of the data then you should be able to keep the product table just on Elasticsearch. Good luck, and option 2 is just as reliable/redundant as your database/system architecture. I like the idea of having the data on two places in ELS to enable blue-green deployment if anything happens to your production ELS cluster. @Hooman_Bahreini

1 Like

Thansk a lot

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.