Search code examples
javamysqlelasticsearchelasticsearch-jdbc-river

How to Synchronize the DB from Index Using Elasticsearch


I have an use case where an Elasticsearch index and a MySQL Database should be remain synchronized and meet the following conditions.

1) Whenever I insert/update/delete in Elasticsearch index it should be synchronized with the Database(MySQL).

2) This synchronization should be done instantly.

3) For the Elasticsearch Index I am doing insert/update/delete at any time with any number of requests.

How can I do this using Elasticsearch?

Thanks!!


Solution

  • Check this out - Listener for ES

    So this is essentially a listener which gets invoked when the index gets updated / deleted . So override the method postCreate ,postIndex and postDelete and accordingly update the MySQl DB