By default, when a previously unseen field is found in a document,
Elasticsearch will add the new field to the type mapping. This behaviour can
be disabled, both at the document and at the
object level, by
dynamic parameter to
false (to ignore new fields) or to
strict (to throw
an exception if an unknown field is encountered).
dynamic field mapping is enabled, some simple rules are used to
determine which datatype the field should have:
No field is added.
floating point number
Depends on the first non-
These are the only field datatypes that are dynamically detected. All other datatypes must be mapped explicitly.
Besides the options listed below, dynamic field mapping rules can be further
date_detection is enabled (default), then new string fields are checked
to see whether their contents match any of the date patterns specified in
dynamic_date_formats. If a match is found, a new
date field is
added with the corresponding format.
The default value for
"yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"]
Dynamic date detection can be disabled by setting
While JSON has support for native floating point and integer datatypes, some applications or languages may sometimes render numbers as strings. Usually the correct solution is to map these fields explicitly, but numeric detection (which is disabled by default) can be enabled to do this automatically: