title: Set up Elasticsearch suggesters that can return suggestions from different data types
body: <p>We're in the process of setting up Amazon Elasticsearch Service (running Elasticsearch version 2.3).</p>
  
  <p>We have different types of data (that I'm currently thinking of as different <em>document types</em> within the same <em>index</em>).</p>
  
  <p><strong>We have a generic search in an app where we want an inline autocomplete function, that is, a <em>completion suggester</em> returning hits from all different data (document) types. How can that be set up?</strong></p>
  
  <p>When <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-completion.html#querying" rel="nofollow">querying suggesters</a> you have to specify an index, so that's why I wanted to keep all the data in the same index. According to the documentation, the completion suggester considers all documents in the index.</p>
  
  <p>Setting up the completion suggester for the first document type was pretty straight forward and is working great. However, as far as I can see you to specify a <em>suggest field</em> when querying. That would be all good hadn't it been for the error message we get when setting up the  mapping for the second document type:</p>
  
  <blockquote>
    <p>Type: illegal_argument_exception Reason: "[suggest] is defined as an object in mapping [name_of_document_type] but this name is already used for a field in other types"</p>
  </blockquote>
  
  <p><strong>Writing this question I see that it's possible to specify more than one suggester in a single suggest query. Maybe that is what we have to solve it? (I.e. get X results from Y suggesters where we compare the scores to get the 1 suggestion we want to present to the user.)</strong></p>