Created
November 15, 2012 16:41
-
-
Save amejiarosario/4079630 to your computer and use it in GitHub Desktop.
elastic search cheatsheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/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