Sha256: 3c36648b28b92fac759a70acdc30d64a78e99a7e1d0e1517cefd004b3196e3dd

Contents?: true

Size: 578 Bytes

Versions: 3

Compression:

Stored size: 578 Bytes

Contents

class ::Article < ActiveRecord::Base
  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks

  document_type 'article'

  settings index: {number_of_shards: 1, number_of_replicas: 0} do
    mapping do
      indexes :title, type: 'text', analyzer: 'snowball'
      indexes :body, type: 'text'
      indexes :clicks, type: 'integer'
      indexes :created_at, type: 'date'
    end
  end

  def as_indexed_json(options = {})
    attributes
        .symbolize_keys
        .slice(:title, :body, :clicks, :created_at)
        .merge(suggest_title: title)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
elasticsearch-model-6.1.2 spec/support/app/article.rb
elasticsearch-model-6.1.1 spec/support/app/article.rb
elasticsearch-model-6.1.0 spec/support/app/article.rb