If you want to setup quickly elasticsearch you can use the searchkick gem :
gem 'searchkick'
Add searchkick to models you want to search.
class Product < ActiveRecord::Base searchkick end
Add data to the search index.
Product.reindex
And to query, use:
products = Product.search "apples" products.each do |product| puts product.name end
Pretty quick, elasticsearch knowledge not required ;-)
More information here : https://github.com/ankane/searchkick