How to build task 'elasticsearch:import:model&

2019-03-16 13:33发布

问题:

Well, I have elasticsearch-rails gem installed (version 0.1.5) and I can clearly see the task inside the gem files.

But when I run

bundle exec rake environment elasticsearch:import:model CLASS='Comment'

I get this error.

Running rake environment -D doesn't show me the task either.

elasticsearch is running, if I curl http://localhost:9200 it responds me.

Why isn't this working?

回答1:

you need create elasticsearch.rake

cat lib/tasks/elasticsearch.rake
require 'elasticsearch/rails/tasks/import'