OpenSearch/docs/reference/index-modules/mapper.asciidoc

54 lines
1.9 KiB
Plaintext
Raw Normal View History

[[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]
2014-03-07 08:21:45 -05:00
=== Dynamic Mappings
2014-03-07 08:21:45 -05:00
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).
2014-03-07 08:21:45 -05:00
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_ : {
}
}
--------------------------------------------------
2014-03-07 08:21:45 -05:00
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 default mapping can be overridden by specifying the `_default_` type when
creating a new index.
Dynamic creation of mappings for unmapped types can be completely
disabled by setting `index.mapper.dynamic` to `false`.