title: Elasticsearch multiple analyzers for a single field
body: <p>I store different kinds of documents in a single index with strict predefined mapping. All of them have some field (say, "body"), but I'd want them to be analyzed slightly differently when indexed (for example, to use different token filters for specific documents) and treaten the same way while searched. As far as I know, analyzers can't be specified per document.</p>
  
  <p>What I also considered to use:</p>
  
  <ol>
  <li>Object fields with differently analyzed subfields for document kinds, so each document has only one filled subfield (like, "body.mail", "body.html"). The problem is that I couldn't search on the whole "body" field which would look through all its subfields (to not break the existing application).</li>
  <li>New reincarnation of multi-fields (to have "body" field with a generic analyzer and custonly analyzed "mail", "html", etc. inside it). Hovewer, I'm not sure if it's possible to use them directly while indexing and indirectly while searching (e.g., to save object with <code>{"mail":"smth"}</code> to use a specific index analyzer, then search by <code>"query":{"body":"smth"}</code> to use generic search analyzer).</li>
  <li>To separate "body" into several fields with different mappings, remove them from <code>_all</code>, and set <code>copy_to</code> to a single <code>body</code> field. I'm not sure, but it will add a substantial index overhead due to copying.</li>
  </ol>