title: How to change field types for existing index using Elasticsearch Mapping API
body: <p>I am using <code>ELK</code> and have the following document structure</p>
  
  <pre><code> {
    "_index": "prod1-db.log-*",
    "_type": "db.log",
    "_id": "AVadEaq7",
    "_score": null,
    "_source": {
      "message": "2016-07-08T12:52:42.026+0000 I NETWORK  [conn4928242] end connection 192.168.170.62:47530 (31 connections now open)",
      "@version": "1",
      "@timestamp": "2016-08-18T09:50:54.247Z",
      "type": "log",
      "input_type": "log",
      "count": 1,
      "beat": {
        "hostname": "prod1",
        "name": "prod1"
      },
      "offset": 1421607236,
      "source": "/var/log/db/db.log",
      "fields": null,
      "host": "prod1",
      "tags": [
        "beats_input_codec_plain_applied"
      ]
    },
    "fields": {
      "@timestamp": [
        1471513854247
      ]
    },
    "sort": [
      1471513854247
    ]
  } 
  </code></pre>
  
  <p>I want to change the <code>message</code> field to <code>not_analyzed</code>. I am wondering how to use <code>Elasticsedarch Mapping API</code> to achieve that? For example, how to use <code>PUT Mapping API</code> to add a new type to the existing index?</p>
  
  <p>I am using <code>Kibana 4.5</code> and <code>Elasticsearch 2.3</code>.</p>
  
  <p>UPDATE
  Tried the following <code>template.json</code> in <code>logstash</code>,</p>
  
  <pre><code> 1 {
   2   "template": "logstash-*",
   3   "mappings": {
   4     "_default_": {
   5       "properties": {
   6         "message" : {
   7           "type" : "string",
   8           "index" : "not_analyzed"
   9         }
  10       }
  11     }
  12   }
  13 }
  </code></pre>
  
  <p>got the following errors when starting <code>logstash</code>,</p>
  
  <pre><code>logstash_1       | {:timestamp=&gt;"2016-08-24T11:00:26.097000+0000", :message=&gt;"Invalid setting for elasticsearch output plugin:\n\n  output {\n    elasticsearch {\n      # This setting must be a path\n      # File does not exist or cannot be opened /home/dw/docker-elk/logstash/core_mapping_template.json\n      template =&gt; \"/home/dw/docker-elk/logstash/core_mapping_template.json\"\n      ...\n    }\n  }", :level=&gt;:error}
  logstash_1       | {:timestamp=&gt;"2016-08-24T11:00:26.153000+0000", :message=&gt;"Pipeline aborted due to error", :exception=&gt;#&lt;LogStash::ConfigurationError: Something is wrong with your configuration.&gt;, :backtrace=&gt;["/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.4-java/lib/logstash/config/mixin.rb:134:in `config_init'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.4-java/lib/logstash/outputs/base.rb:63:in `initialize'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.4-java/lib/logstash/output_delegator.rb:74:in `register'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.4-java/lib/logstash/pipeline.rb:181:in `start_workers'", "org/jruby/RubyArray.java:1613:in `each'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.4-java/lib/logstash/pipeline.rb:181:in `start_workers'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.4-java/lib/logstash/pipeline.rb:136:in `run'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.4-java/lib/logstash/agent.rb:473:in `start_pipeline'"], :level=&gt;:error}
  logstash_1       | {:timestamp=&gt;"2016-08-24T11:00:29.168000+0000", :message=&gt;"stopping pipeline", :id=&gt;"main"}
  </code></pre>