Mapperedit

The mapper module acts as a registry for the type mapping definitions added to an index either when creating it or by using the put mapping api. It also handles the dynamic mapping support for types that have no explicit mappings pre defined. For more information about mapping definitions, check out the mapping section.

Dynamic Mappingsedit

New types and new fields within types can be added dynamically just by indexing a document. When Elasticsearch encounters a new type, it creates the type using the _default_ mapping (see below).

When it encounters a new field within a type, it autodetects the datatype that the field contains and adds it to the type mapping automatically.

See Dynamic Mapping for details of how to control and configure dynamic mapping.

Default Mappingedit

When a new type is created (at index creation time, using the put-mapping API or just by indexing a document into it), the type uses the _default_ mapping as its basis. Any mapping specified in the create-index or put-mapping request override values set in the _default_ mapping.

The default mapping definition is a plain mapping definition that is embedded within ElasticSearch:

{
    _default_ : {
    }
}

Pretty short, isn’t it? Basically, everything is `default`ed, including the dynamic nature of the root object mapping which allows new fields to be added automatically.

The built-in default mapping definition can be overridden in several ways. A _default_ mapping can be specified when creating a new index, or the global _default_ mapping (for all indices) can be configured by creating a file called config/default-mapping.json. (This location can be changed with the index.mapper.default_mapping_location setting.)

Dynamic creation of mappings for unmapped types can be completely disabled by setting index.mapper.dynamic to false.