现在我有:
desc "Index Elastic Search"
namespace :tire do
namespace :import do
task all: :environment do
aliases = Tire::Configuration.client.get(Tire::Configuration.url + '/_aliases').body
indexes_names = MultiJson.load(aliases).keys
indexes_names.each do |name|
index = Tire::Index.new name
index.delete
index.import
index.refresh
puts "[INFO] #{name} re-indexed"
end
end
end
end
但我得到一个错误
wrong number of arguments (0 for 1)
/Users/rege/.rvm/gems/ruby-1.9.3-p194@network/gems/tire-0.5.2/lib/tire/index.rb:185:in `import'
/Users/rege/Code/Network/lib/tasks/tire.rake:15:in `block (4 levels) in <top (required)>'
/Users/rege/Code/Network/lib/tasks/tire.rake:12:in `each'
/Users/rege/Code/Network/lib/tasks/tire.rake:12:in `block (3 levels) in <top (required)>'
Tasks: TOP => tire:import:all