mat's
mat's

Reputation: 49

how can elasticsearch know that i made a sql db update

Rails 3.2.15 and Microsoft sql server 2008. elasticsearch is installed and we use the gems gem 'elasticsearch-model' gem 'elasticsearch-rails' the mapping and search method is done in the rails model. everything works perfect. if we do db changes with rails thanks to the include Elasticsearch::Model::Callbacks elastic knows about the changes. But if we do changes directly to the db, elastic does not know about the changes. How can we solve that?

rails and elastic is installed on a linux server. Sql on windows server 2012

Upvotes: 0

Views: 53

Answers (1)

mat's
mat's

Reputation: 49

After a lot of research and a big help in the Ruby on Rails Link slack channel, the best way would be to migrate a "last_synced_at" datetime field to all my tables, schedule a job to run every X, find all records whose last_snced_at less than Time.current -10 min and reindex those records.

Or i should find a way to know when we have a change in the db and which row to do the reindex

Upvotes: 0

Related Questions