| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 | [[mapping]]= Mapping[partintro]--Mapping is the process of defining how a document should be mapped tothe Search Engine, including its searchable characteristics such aswhich fields are searchable and if/how they are tokenized. InElasticsearch, an index may store documents of different "mappingtypes". Elasticsearch allows one to associate multiple mappingdefinitions for each mapping type.Explicit mapping is defined on an index/type level. By default, thereisn't a need to define an explicit mapping, since one is automaticallycreated and registered when a new type or new field is introduced (withno performance overhead) and have sensible defaults. Only when thedefaults need to be overridden must a mapping definition be provided.[float][[all-mapping-types]]=== Mapping TypesMapping types are a way to divide the documents in an index into logicalgroups. Think of it as tables in a database. Though there is separationbetween types, it's not a full separation (all end up as a documentwithin the same Lucene index).Field names with the same name across types are highly recommended tohave the same type and same mapping characteristics (analysis settingsfor example). There is an effort to allow to explicitly "choose" whichfield to use by using type prefix (`my_type.my_field`), but it's notcomplete, and there are places where it will never work (likeaggregations on the field).In practice though, this restriction is almost never an issue. The fieldname usually ends up being a good indication to its "typeness" (e.g."first_name" will always be a string). Note also, that this does notapply to the cross index case.[float][[mapping-api]]=== Mapping APITo create a mapping, you will need the <<indices-put-mapping,Put MappingAPI>>, or you can add multiple mappings when you <<indices-create-index,create anindex>>.[float][[mapping-settings]]=== Global SettingsThe `index.mapping.ignore_malformed` global setting can be set on theindex level to allow to ignore malformed content globally across allmapping types (malformed content example is trying to index a text stringvalue as a numeric type).The `index.mapping.coerce` global setting can be set on theindex level to coerce numeric content globally across allmapping types (The default setting is true and coercions attempted are to convert strings with numbers into numeric types and also numeric valueswith fractions to any integer/short/long values minus the fraction part).When the permitted conversions fail in their attempts, the value is considered malformed and the ignore_malformed setting dictates what will happen next.--include::mapping/fields.asciidoc[]include::mapping/types.asciidoc[]include::mapping/date-format.asciidoc[]include::mapping/dynamic-mapping.asciidoc[]include::mapping/conf-mappings.asciidoc[]include::mapping/meta.asciidoc[]include::mapping/transform.asciidoc[]
 |