Skip to content

Instantly share code, notes, and snippets.

@kopylovvlad
Last active February 1, 2020 07:05
Show Gist options
  • Save kopylovvlad/13536e1d288b6d0cac6418f471f7fba3 to your computer and use it in GitHub Desktop.
Save kopylovvlad/13536e1d288b6d0cac6418f471f7fba3 to your computer and use it in GitHub Desktop.
class Article < ActiveRecord::Base
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
include ElasticMyAnalyzer
include EsHelper
settings ES_SETTING do
mappings dynamic: 'true' do
indexes :title, type: 'string', analyzer: 'my_analyzer' # or type: 'text' for version 6.1
indexes :description, type: 'string', analyzer: 'my_analyzer' # or type: 'text' for version 6.1
indexes :searching, type: 'boolean'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment