WARNING: The 2.x versions of Elasticsearch have passed their EOL dates. If you are running a 2.x version, we strongly advise you to upgrade.
This documentation is no longer maintained and may be removed. For the latest information, see the current Elasticsearch documentation.
Default Mapping
editDefault Mapping
editOften, all types in an index share similar fields and settings. It can be
more convenient to specify these common settings in the _default_ mapping,
instead of having to repeat yourself every time you create a new type. The
_default_ mapping acts as a template for new types. All types created
after the _default_ mapping will include all of these default settings,
unless explicitly overridden in the type mapping itself.
For instance, we can disable the _all field for all types, using the
_default_ mapping, but enable it just for the blog type, as follows:
PUT /my_index
{
"mappings": {
"_default_": {
"_all": { "enabled": false }
},
"blog": {
"_all": { "enabled": true }
}
}
}
The _default_ mapping can also be a good place to specify index-wide
dynamic templates.