What is the best way to sync Postgres and ElasticSearch?
I recommend you consider https://github.com/debezium/debezium. It has Postgresql support and implements the change capture
model proposed in other posts instead of the dual write
model.
debezium benefits:
- low latency change streaming
- stores changes in a replicated log for durability
- emits only write events (creates, updates, deletes) which can be consumed and piped into other systems.
UPD. Here is a simple github repository, which shows how it works
as you are asking for the ways, I assume you want to know the possibilities to apply the better architecture, I would like you to propose an advice given by confluent:
here https://www.confluent.io/blog/bottled-water-real-time-integration-of-postgresql-and-kafka/