Prerequisite:
- Elasticsearch is up and running
- Database is already filled with data
Rails models look like
class Customer < ActiveRecord::Base include Elasticsearch::Model include Elasticsearch::Model::Callbacks end
Question: What is the correct way to index the models?
My assumption:
- Execute the following rake task for every model I want to add to elasticsearch, but only the very first time
bundle exec rake environment elasticsearch:import:model CLASS='Customer'
- I add "Customer.import" to the very bottom of the models file to insure that the models get indexed every time I start my rails application.
Is that enough? Will this work, even if I change the mappings of the model or if I add a new field?