ElasticRecord
<img src=“https://secure.travis-ci.org/matthuhiggins/elastic_record.png?rvm=1.9.3” />
ElasticRecord is an elasticsearch ORM.
Setup
The usual Gemfile addition:
gem 'elastic_record'
Creating the index:
rake index:create
Include ElasticRecord into your model:
ActiveSupport.on_load :active_record do
include ElasticRecord::Model
end
Querying:
scope = Product.elastic_search
scope.filter(color: 'red')
scope.order(:price)
scope.count
scope.first
scope.all
scope.each do |product|
...
end
Class methods are executed within scopes:
class Pirate
def self.ouput_to_screen
all.each do { |widget| puts widget }
end
end
scope.output_to_screen