After failing to get Elasticsearch::Extensions::Test::Cluster::Cluster
, using Rowan Oulton's aproach, to work on Travis CI due to:
Starting 1 Elasticsearch node../usr/local/bin/elasticsearch: line 17: /usr/local/bin/elasticsearch-env: No such file or directory
/usr/local/bin/elasticsearch: line 20: : command not found
/usr/local/bin/elasticsearch: line 24: : command not found
/usr/local/bin/elasticsearch: line 29: exec: : not found
[!!!] Process failed to start (see output above)
We've resorted to using Bonsai as elasticsearch provider in all environments, including test.
A simple check can be added to config/initializers/elasticsearch.rb
to check the existence if ENV["BONSAI_URL"]
and leave the client with the default configuration, thus running locally.
We installed elasticsearch locally with:
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
brew services start elastic/tap/elasticsearch-full
OurModel.__elasticsearch__.create_index!(force: true)
OurModel.import