Dynamic mapper not working with default mapping

Hello,
I try to develop solution for use case, when client can create new index only if this index have template.
As one of possible solutions, i inserted 2 templates:

PUT _template/template_all
{
  "template": "*",
  "order":0,
  "settings": {
    "index.mapper.dynamic": false 
  }
}

And

PUT _template/template_1
{
  "template": "test*",
  "settings": {
    "index.mapper.dynamic": true
  },
  "mappings": {
    "_default_": {
      "_all": {
        "enabled": false
      },
      "dynamic_templates": [
        {
          "strings": {
            "match_mapping_type": "string",
            "mapping": {
              "type": "text",
              "fields": {
                "raw": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            }
          }
        }
      ]
    }
  }
}

If i understand right, now all indexes that started with "test" supposed to be creates with ALL document types.
But as result i received exception "trying to auto create mapping, but dynamic mapping is disabled"
There is no exceptions if i insert the template with defined document type.

So is this correct, that dynamic mapper not working with default mapping?
Anybody know other solution for my use case?

Thank a lot

Templates with conflicting patterns will get combined/merged and the order that this happens is defined by the order attribute. Since you have not defined an order attribute for template_1 it could be the case that the order being used is actually template_1 first then template_all last, so the final value of index.mapper.dynamic will be false.

Try setting "order": 1 in template template_1 to guarantee that the order will be template_all first then template_1 last.

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