I have simple Rails app with a Post model that belongs to a creator (which is a User object) and I want to find posts that match the creator's first_name.
class Post < ActiveRecord::Base
  include Tire::Model::Search
  include Tire::Model::Callbacks
  belongs_to :creator, polymorphic: true
  mapping do
    indexes :id, type: 'integer'
    indexes :title, boost: 10
    indexes :creator do
      indexes :first_name
      indexes :service_type
    end
  end
end
When I run search, there are no results:
Post.tire.search(load: true, page: params[:page], per_page: params[:per_page]) do
  query do
    match 'creator.first_name', 'Matt'
  end
end
Even when I've run rake environment tire:import:all FORCE=true and verified that a Post exists with a creator that has a first name of 'Matt' in the database.
Is there something I am missing? Thanks!
UPDATE:
Adding the following to Post.rb did the trick:
def to_indexed_json
  as_json.merge(
    creator: creator.as_indexed_json
  ).to_json
end
Apparently, you need to specify the association in the to_indexed_json to make it work.