📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Elasticsearch Mapping

Mapping

5 min read Quiz at the end
Define field types in mappings: text for search, keyword for exact match, date, float, geo_point.

Elasticsearch Mapping

# Define field types (like a DB schema)
PUT /posts
{
  "mappings": {
    "properties": {
      "title":      { "type": "text", "analyzer": "english" },
      "body":       { "type": "text" },
      "author":     { "type": "keyword" },
      "tags":       { "type": "keyword" },
      "price":      { "type": "float" },
      "is_active":  { "type": "boolean" },
      "created_at": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||epoch_millis" },
      "location":   { "type": "geo_point" }
    }
  }
}

# View mapping
GET /posts/_mapping

# Types: text, keyword, integer, float, boolean, date, object, nested, geo_point
Topic Quiz · 1 questions

Test your understanding before moving on

1. What is the difference between text and keyword field types?
💡 text fields are tokenised and analysed; keyword fields store exact values for sorting/filtering.