Skip to content

Instantly share code, notes, and snippets.

@wireframe
Created February 2, 2011 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wireframe/808316 to your computer and use it in GitHub Desktop.
Save wireframe/808316 to your computer and use it in GitHub Desktop.
teardown/recreate index for testcases
require 'rubygems'
require 'rubberband'
index = 'foo'
type = 'bar'
searcher = ElasticSearch.new("localhost:9200", :index => index, :type => type)
searcher.delete_index(index) rescue nil
searcher.create_index index
searcher.index({:name => 'foo'})
searcher.refresh
searcher.search 'foo'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment