1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- [[index-modules-mapper]]
- == Mapper
- 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,mapping section>>.
- [float]
- === Dynamic Mappings
- 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 <<mapping-dynamic-mapping>> for details of how to control and
- configure dynamic mapping.
- [float]
- === Default Mapping
- When a new type is created (at <<indices-create-index,index creation>> time,
- using the <<indices-put-mapping,`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 <<indices-create-index,`create-index`>> or
- <<indices-put-mapping,`put-mapping`>> request override values set in the
- `_default_` mapping.
- The default mapping definition is a plain mapping definition that is
- embedded within ElasticSearch:
- [source,js]
- --------------------------------------------------
- {
- _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`.
|