WARNING: Version 5.4 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
default mapping
edit_default_
mapping
editThe default mapping, which will be used as the base mapping for any new
mapping types, can be customised by adding a mapping type with the name
_default_
to an index, either when
creating the index or later on with the
PUT mapping API.
PUT my_index { "mappings": { "_default_": { "_all": { "enabled": false } }, "user": {}, "blogpost": { "_all": { "enabled": true } } } }
The |
|
The |
|
The |
When updating the _default_
mapping with the
PUT mapping API, the new mapping is not merged with
the existing mapping. Instead, the new _default_
mapping replaces the
existing one.
While the _default_
mapping can be updated after an index has been created,
the new defaults will only affect mapping types that are created afterwards.
The _default_
mapping can be used in conjunction with
Index templates to control dynamically created types
within automatically created indices:
PUT _template/logging { "template": "logs-*", "settings": { "number_of_shards": 1 }, "mappings": { "_default_": { "_all": { "enabled": false }, "dynamic_templates": [ { "strings": { "match_mapping_type": "string", "mapping": { "type": "text", "fields": { "raw": { "type": "keyword", "ignore_above": 256 } } } } } ] } } } PUT logs-2015.10.01/event/1 { "message": "error:16" }