Build the mental model
Lesson 8 went deep on `text` vs `keyword`, dates, and numbers, and the Lesson 21 project designed the whole Tutorial Platform index hands-on — this exercise asks you to independently repeat that decision-making process on a new domain (a product catalog), designing just the mapping JSON without building a full running app. Systematically decide each field's type by asking: does it need full-text search (`text`), exact matching/filtering/aggregation (`keyword`), numeric range queries (`integer`/`float`), or date math (`date`)? The `price` field is an interesting edge case — it clearly needs a numeric type (`float`/`scaled_float`) for range queries (`WHERE price < 50`), but you should also consider `scaled_float` (storing an internal integer with a scaling factor to simulate decimals) to protect money precision from floating-point rounding error — this directly echoes the Redis course's lesson that storing money as a floating-point score doesn't give you accounting-grade precision.
Connect it to a real scenario
Analyze the requirements of each product catalog field — design `name` (the product title, needing full-text search on the search box plus exact matching for admin sort) with a `text` plus `.keyword` sub-field (Lesson 8's multi-field pattern); leave `description` (long-form text, needing only full-text search) as plain `text`; give `price` (needing range filters and exact-value comparison) type `scaled_float` (scaling factor 100); give `category` (a dropdown value, needing exact filtering and facets) type `keyword`; and give `tags` (multiple values, facets) a `keyword` array.
Try the working example
// Your task: complete this mapping for a product catalog index.
PUT /products
{
"mappings": {
"properties": {
"name": { /* your design here */ },
"description": { /* your design here */ },
"price": { /* your design here */ },
"category": { /* your design here */ },
"tags": { /* your design here */ }
}
}
}You produce a complete mapping JSON you designed yourself for the product catalog's five fields.5-minute try-it
Complete the starter mapping above — add a one-line comment for each field explaining why you chose that type.
One important caution
Mapping the `price` field as `text` or `keyword` — range queries (`price < 50`) and `avg`/`sum` aggregations become impossible to run.
Mapping the `category` field as `text` — running the admin dashboard's "product count per category" `terms` aggregation splits into one bucket per individual word inside the category name, not the intended result.
Elasticsearch Guide — Field Data Types — Elastic