Mapping
Learn about the process of mapping and its types in Elasticsearch.
We'll cover the following...
Overview
In ElasticSearch, mapping is the process of defining how a document and its fields are indexed and stored. It’s similar to a table description in a relational database or a schema definition in a document store database (NoSQL). Mapping can be defined using the following:
- Dynamic mapping
- Explicit mapping
Dynamic mapping
Dynamic mapping is a feature in Elasticsearch that automatically detects the data type of a field and creates the mapping for it. More simply, if a field is not present in the mapping, Elasticsearch automatically adds the field to the mapping with the appropriate data type.
When Elasticsearch ingests a JSON object, it will analyze the keys and values within the object to determine their data types. It can recognize common data types such as numbers, strings, and dates.
The following illustration shows JSON data and how Elasticsearch identifies the type of its fields.
After identifying JSON types, Elasticsearch uses the rules in the following table to determine how to map data types for each field.
JSON Data Type | Specifications | Elasticsearch Mapping |
| - |
|
| - |
|
| - |
|
| - |
|
| Depends on the first non-null value in the |
|
| Strings that contain dates such as |
|
| Strings that contain numbers such as |
|
| Strings that contain normal text such as |
|
Note: More details about the data types Elasticsearch provides ...