ElasticSearch is a search engine. I would advise you not to use it as a database system. I suggest you index only search data and a unique identifier from your database so that you can retrieve results from MySQL using the unique key returned by ElasticSearch. Thus, you will use both applications for your purposes. An elastic search is not the best for relationship queries, and you will have to write a lot more code to work with the relevant data than just using MySql for it.
In addition, you do not want to link your persistence level using the search layer. They should be as independent as possible, and a change in one should not affect the other as much as possible. Otherwise, you will have to update both systems if they need to change. MySQL query on some identifiers is very fast, so you can use it and leave the slow part (full-text query) to search for elasticity.
source share