title: Elasticsearch-rails completion suggester, map data, create indexes, suggest method
body: <p>I am using <code>elasticsearch-model</code> and <code>elasticsearch-rails</code> gems.</p>
  
  <p>In my Profile model I have</p>
  
  <pre><code>settings index: { number_of_shards: 3 } do
      mappings dynamic: 'false'  do
        indexes :profile_type, analyzer: 'keyword'
        indexes :profile do |p|
          indexes :name, type: 'multi_field' do
            indexes :name, analyzer: 'snowball'
            indexes :tokenized, analyzer: 'keyword'
          end
        end
      end
   end
  </code></pre>
  
  <p>I tried adding <code>suggest</code> field </p>
  
  <pre><code>settings index: { number_of_shards: 3 } do
      mappings dynamic: 'false'  do
        indexes :profile_type, analyzer: 'keyword'
        indexes :suggest, type: 'suggest' # not sure about this
        # do not really know how to index this field
        indexes :profile do |p|
          indexes :name, type: 'multi_field' do
            indexes :name, analyzer: 'snowball'
            indexes :tokenized, analyzer: 'keyword'
          end
        end
      end
   end
  </code></pre>
  
  <p>I am trying to make suggest on <code>profile.name</code> , I have added <code>as_indexed_json</code> </p>
  
  <pre><code>def as_indexed_json(options={})
      suggest= {
       suggest: {
        :input =&gt; profile.name,
        :output =&gt; profile.name,
        :payload =&gt; {
          name: profile.name
        }
       }
      }
      self.as_json(
        :only =&gt; [:profile_type, :slug],
        :include =&gt; {
          :profile =&gt; {}
        }
      ).merge(suggest)
  end
  </code></pre>
  
  <p>Any help would be appreciated, any suggestion.</p>