title: Elastic search index only searchable fields
body: <p>I would like to create an index in which only some fields are indexed. I created a template with the <code>enabled</code> property set to false. So no field is indexed by default.
  <a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.4/enabled.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/reference/6.4/enabled.html</a></p>
  
  <p>Then I defined the fields I want to index with dynamic templates. After I inserted a document, no field is indexed. I guess it's because <code>enabled:false</code> is applied on the children of the root element, and since none should be indexed, the dynamic templates are not applied.</p>
  
  <p>Is there a way to set the enabled to false for all fields not covered by the dynamic templates?</p>
  
  <pre><code>DELETE so
  
  DELETE _template/test
  
  PUT _template/test
  {
    "index_patterns": [
      "*so*"
    ],
    "settings": {
      "number_of_shards": 1
    },
    "mappings": {
      "_doc": {
        "dynamic": true,
        "enabled": false,
        "dynamic_templates": [
          {
            "typeOfMaterial": {
              "path_match": "*.material.typeOfMaterial",
              "mapping": {
                "enabled": true,
                "type": "nested"
              }
            }
          },
          {
            "typeOfMaterialCode": {
              "path_match": "*.material.typeOfMaterial.code",
              "mapping": {
                "enabled": true,
                "type": "keyword"
              }
            }
          }
        ]
      }
    }
  }
  
  PUT so/_doc/1
  {
    "count": 5,
    "AAA": {
      "material": {
        "typeOfMaterial": [
          {
            "code": "MAT1"
          }
        ]
      }
    }
  }
  </code></pre>