title: How to specify an analyzer while creating an index in ElasticSearch
body: <p>I'd like to specify an analyzer, name it, and use that name in a mapping while creating an index.  I'm lost, my ES instance always returns me an error message.</p>
  
  <p>This is, roughly, what I'd like to do:</p>
  
  <pre><code>"settings": {
    "mappings": {
      "alfedoc": {
        "properties": {
          "id": { "type": "string" },
          "alfefield": { "type": "string", "analyzer": "alfeanalyzer" }
        }
      }
    },
    "analysis": {
      "analyzer": {
        "alfeanalyzer": {
          "type": "pattern",
          "pattern":"\\s+"
        }
      }
    }
  }
  </code></pre>
  
  <p>But this does not seem to work; the ES instance always returns me an error like</p>
  
  <pre><code>MapperParsingException[mapping [alfedoc]]; nested: MapperParsingException[Analyzer [alfeanalyzer] not found for field [alfefield]];
  </code></pre>
  
  <p>I tried putting the <code>"analysis"</code> branch of the dictionary at several places (inside the mapping etc.) but to no avail.  I guess a working complete example (which I couldn't find up to now) would help me along as well.  Probably I'm missing something rather basic.</p>