Understanding Field Mappings
Elasticsearch Mappings & Dynamic Fields
Dynamic vs explicit mappings and why it matters
By Sharanmeet Singh••
Tags:ElasticsearchOpenSearchMappingsDynamic Fields
Search Query Generator
Generate search queries and filters
Mappings in Elasticsearch
Mappings define how fields are stored and analyzed.
Dynamic Mapping Example
{
"mappings": {
"dynamic": true
}
}
New fields are auto-created.
Explicit Mapping Example
{
"mappings": {
"properties": {
"status": { "type": "keyword" },
"price": { "type": "float" }
}
}
}
Manual control over field types.
Pitfalls
- Dynamic fields bloat index
- Wrong field types (string → text instead of keyword)
- Hard to fix later without reindexing
Best Practice: Always use explicit mappings for important fields.