How to run elasticsearch server in rspec How to run elasticsearch server in rspec elasticsearch elasticsearch

How to run elasticsearch server in rspec


I remember having a similar problem, and I solved it with the following line in my test_helper:

ENV["TEST_CLUSTER_NODES"] = "1" # need to set so we trigger correct ES defaults

I figured it out by looking at the Elasticsearch::Extensions::Test::Cluster source and realizing that Elasticsearch::Extensions::Test::Cluster.running? was returning true (and therefore not starting the cluster) unless that TEST_CLUSTER_NODES value is set.