Sha256: efd7409640bb8b103c8b5cf31e5bc3b646d8e884467adfbb197f040d22de25c1

Contents?: true

Size: 412 Bytes

Versions: 5

Compression:

Stored size: 412 Bytes

Contents

module ElasticHelper
  def index_exist?(index_name)
    out, err, status = Open3.capture3("curl -XGET '#{elastic_url}/#{index_name}/'")
    !out.include?('index_not_found_exception')
  end

  def remove_index(index_name)
    system("curl -XDELETE '#{elastic_url}/#{index_name}/' > /dev/null 2>&1")
  end

  def elastic_url
    host = ENV['ELASTICSEARCH_HOST'] || 'localhost'
    "http://#{host}:9200/"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gitlab-elasticsearch-git-1.0.2 spec/support/elastic_helper.rb
gitlab-elasticsearch-git-1.0.1 spec/support/elastic_helper.rb
gitlab-elasticsearch-git-1.0.0 spec/support/elastic_helper.rb
gitlab-elasticsearch-git-0.0.17 spec/support/elastic_helper.rb
gitlab-elasticsearch-git-0.0.16 spec/support/elastic_helper.rb