Documented how to define custom mappings for all indexes and all types

Closes #15557
This commit is contained in:
Felipe Forbeck 2015-12-19 02:38:40 -02:00 committed by Clinton Gormley
parent 77e9eed6f1
commit 9965c83ae4
1 changed files with 33 additions and 0 deletions

View File

@ -250,3 +250,36 @@ PUT my_index/my_type/1
<1> The `english` field is mapped as a `string` field with the `english` analyzer.
<2> The `count` field is mapped as a `long` field with `doc_values` disabled
[[override-default-template]]
=== Override default template
You can override the default mappings for all indices and all types
by specifying a `_default_` type mapping in an index template
which matches all indices.
For example, to disable the `_all` field by default for all types in all
new indices, you could create the following index template:
[source,js]
--------------------------------------------------
PUT _template/disable_all_field
{
"disable_all_field": {
"order": 0,
"template": "*", <1>
"mappings": {
"_default_": { <2>
"_all": { <3>
"enabled": false
}
}
}
}
}
--------------------------------------------------
// AUTOSENSE
<1> Applies the mappings to an `index` which matches the pattern `*`, in other
words, all new indices.
<2> Defines the `_default_` type mapping types within the index.
<3> Disables the `_all` field by default.