Skip to content

Instantly share code, notes, and snippets.

@amejiarosario
Created November 15, 2012 16:41
Show Gist options
  • Save amejiarosario/4079630 to your computer and use it in GitHub Desktop.
Save amejiarosario/4079630 to your computer and use it in GitHub Desktop.
elastic search cheatsheet
# ~/elasticsearch-0.19.11/bin/elasticsearch -f
#
# Include to and active record model
#
class Log < ActiveRecord::Base
include Tire::Model::Search
include Tire::Model::Callbacks
end
#
# Index it
#
Log.index.delete
Log.index.create
# irb, method #1
Log.index.import Log.all
# irb, method #2 (bulk 1000)
Log.import
Log.import :per_page => 500
# rake task
rake environment tire:import CLASS='Article' FORCE=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment