Skip to content

Instantly share code, notes, and snippets.

@letsbreelhere
Created June 8, 2012 20:18
Show Gist options
  • Save letsbreelhere/2897945 to your computer and use it in GitHub Desktop.
Save letsbreelhere/2897945 to your computer and use it in GitHub Desktop.
# config/elastic_search.rb
ElasticSearchSettingsForUser = YAML.load_file('config/elastic_search_user.yml').with_indifferent_access
# user.rb
class User < ActiveRecord::Base
settings ElasticSearchSettingsForUser do
mapping do
[:name, :email, :company].each do |attribute|
indexes attribute, type: 'string', analyzer: 'ngram_analyzer'
end
end
end
#...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment