| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 | [[mapping]]= Mapping[partintro]--Mapping is the process of defining how a document, and the fields it contains,are stored and indexed.Each document is a collection of fields, which each have their own<<mapping-types,data type>>. When mapping your data, you create a mappingdefinition, which contains a list of fields that are pertinent to the document.A mapping definition also includes <<mapping-fields,metadata fields>>, like the`_source` field, which customize how a document's associated metadata ishandled.Use _dynamic mapping_ and _explicit mapping_ to define your data. Each methodprovides different benefits based on where you are in your data journey. Forexample, explicitly map fields where you don't want to use the defaults, or togain greater control over which fields are created. You can then allow {es} toadd other fields dynamically.NOTE: Before 7.0.0, the mapping definition included a type name.{es} 7.0.0 and later no longer accept a _default_ mapping. See <<removal-of-types>>..Experiment with mapping options****<<runtime-search-request,Define runtime fields in a search request>> toexperiment with different mapping options, and also fix mistakes in your indexmapping values by overriding values in the mapping during the search request.****[discrete][[mapping-dynamic]]== Dynamic mapping<<dynamic-field-mapping,Dynamic mapping>> allows you to experiment withand explore data when you’re just getting started. {es} adds new fieldsautomatically, just by indexing a document. You can add fields to the top-levelmapping, and to inner <<object,`object`>>  and <<nested,`nested`>> fields.Use <<dynamic-templates,dynamic templates>> to define custom mappings that areapplied to dynamically added fields based on the matching condition.[discrete][[mapping-explicit]]== Explicit mapping<<explicit-mapping,Explicit mapping>> allows you to precisely choose how todefine the mapping definition, such as:* Which string fields should be treated as full text fields.* Which fields contain numbers, dates, or geolocations.* The <<mapping-date-format,format>> of date values.* Custom rules to control the mapping for  <<dynamic-mapping,dynamically added fields>>.Use <<runtime-mapping-fields,runtime fields>> to make schema changes withoutreindexing. You can use runtime fields in conjunction with indexed fields tobalance resource usage and performance. Your index will be smaller, but withslower search performance.[discrete][[mapping-limit-settings]]== Settings to prevent mapping explosionDefining too many fields in an index can lead to a mapping explosion, which cancause out of memory errors and difficult situations to recover from.Consider a situation where every new document insertedintroduces new fields, such as with <<dynamic-mapping,dynamic mapping>>.Each new field is added to the index mapping, which can become aproblem as the mapping grows.Use the <<mapping-settings-limit,mapping limit settings>> to limit the numberof field mappings (created manually or dynamically) and prevent documents fromcausing a mapping explosion.--include::mapping/dynamic-mapping.asciidoc[]include::mapping/explicit-mapping.asciidoc[]include::mapping/runtime.asciidoc[]include::mapping/types.asciidoc[]include::mapping/fields.asciidoc[]include::mapping/params.asciidoc[]include::mapping/mapping-settings-limit.asciidoc[]include::mapping/removal_of_types.asciidoc[]
 |