Created
October 1, 2016 21:31
-
-
Save pecavalheiro/fdb425c312b89413d6393320687b0795 to your computer and use it in GitHub Desktop.
Snippets for Medium Post = Rails + Elasticsearch 101
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Article < ActiveRecord::Base | |
| include Elasticsearch::Model | |
| include Elasticsearch::Model::Callbacks | |
| settings index: { number_of_shards: 1 } do | |
| mappings dynamic: 'false' do | |
| indexes :name | |
| indexes :author | |
| indexes :location, type: :geo_point | |
| indexes :created_at, type: :date | |
| indexes :updated_at, type: :date | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment