in models based on attributes class Track < ActiveRecord::Base belongs_to :artist define_index do indexes :title indexes artist(:name), as: :artist_name has :artist_id, type: :integer has "privacy = #{Privacies::PUBLIC}", as: :is_public, type: :boolean where "deleted_at IS NULL" set_property delta: :datetime, threshold: 12.minutes end end