> For the complete documentation index, see [llms.txt](https://xiaoxiami.gitbook.io/elasticsearch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xiaoxiami.gitbook.io/elasticsearch/ji-chu/mapping/324dynamic-mappingff08-dong-tai-ying-she-ff09/override-default-templatefu-gai-mo-ren-mo-677f29.md).

# Override default template(覆盖默认模板)

你可以在一个匹配所有索引的模板中，通过指定\_default\_类型映射来覆盖所有索引和所有类型的默认映射。

例如，要在所有新的索引中默认禁用所有类型的\_all字段，你可以创建以下的索引模板：

```
PUT _template/disable_all_field
{
  "order": 0,
  "template": "*",              #1
  "mappings": {
    "_default_": {              #2
      "_all": {                 #3
        "enabled": false
      }
    }
  }}
```

| 1 | 将模式\*匹配映射应用到一个index(索引)，换句话说，就是应用到所有新的索引。 |
| - | ----------------------------------------- |
| 2 | 在索引中定义\_default\_类型的映射。                   |
| 3 | 默认情况下禁用\_all字段。                           |
