Suspected bug: cannot disable a field using dynamic templates

I am trying to use a dynamic template to disable analysis on a field by setting enabled: false in its mapping.

This is the mapping I'm using:

{
  "mappings": {
    "dynamic": true,
    "dynamic_templates": [
      {
        "disable_field": {
          "match": "disabled-field",
          "mapping": {
            "enabled": false
          }
        }
      }
    ]
  }
}

When I index this document:

{
    "disabled-field": "a string"
}

The mapping is created with disabled-field as type text:

{
  "disabled-field-index" : {
    "mappings" : {
      "dynamic" : "true",
      "dynamic_templates" : [
        {
          "disable_field" : {
            "match" : "disabled-field",
            "mapping" : {
              "enabled" : false
            }
          }
        }
      ],
      "properties" : {
        "disabled-field" : {
          "type" : "text"
        }
      }
    }
  }
}

Shouldn't the disabled-field have enabled: false after indexing the document?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.