title: How to create index of an instance method in elasticsearch-rails?
body: <p><strong>What I want to do</strong></p>
  
  <p><a href="https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model" rel="nofollow noreferrer">https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model</a></p>
  
  <p>Using this gem, I wanna create indexes of User model, including output of method named <code>full_name</code>. <code>User</code> has columns of <code>id, first_name, last_name</code>.</p>
  
  <pre><code>class User
    ...
    def full_name
      first_name + last_name
    end
    ...
  end
  </code></pre>
  
  <p><strong>What I did</strong></p>
  
  <pre><code>module UserSearchable
    extend ActiveSupport::Concern
  
    included do
      include Searchable
      settings index: {
        ...
      }
  
      mappings do
        indexes :id, type: :integer
        indexes :first_name, type: text
        indexes :last_name, type: text
        indexes :full_name, type: text, as: 'full_name'
      end
  
      def as_indexed_json(options={})
        as_json(
          methods: [:full_name]
        )
      end
    end
  end
  </code></pre>
  
  <p>I referred to this question.
  <a href="https://stackoverflow.com/questions/13600086/index-the-results-of-a-method-in-elasticsearch-tire-activerecord">Index the results of a method in ElasticSearch (Tire + ActiveRecord)</a></p>
  
  <p>But this doesn't work, ending up with not containing <code>full_name</code> index in the response.</p>
  
  <p>I'm new to elasticsearch and elasticsearch-rails.
  How can I fix this?</p>