Understand the structures behind fast search and how field capabilities affect storage.
course-products examples use the teaching mapping and product from chapter 5, “Mapping and field types”. Exercise walkthroughs below use the trainer’s separate public dataset.
- Product text
- Terms → posting lists
- Intersection → candidates
Understand the structures behind fast search and how field capabilities affect storage.
The course targets Elasticsearch 9.4.3. Exercise examples use the public products dataset; other requests illustrate separate teaching indices and may require setup or privileges unavailable in the trainer. Responses are shortened fragments; scores may vary. Check deployment and license requirements for advanced features.
From term to document
A document tells us which words a product contains. An inverted index answers the reverse question: which documents contain a word? The wireless term has a posting list, and positions support order and distance checks. Intersections support AND, unions support OR. The analyzer determines terms before retrieval starts.
Check your understandingDifferent structures for different jobs
_source serves document retrieval. The inverted index supports term lookup; point structures support numeric and spatial values. Doc values provide column-oriented access for sorting and aggregations. A value being present in _source does not make it available for every search operation: mapping controls its capabilities.
Check your understandingThe cost of capabilities
Multi-fields index multiple representations of one value. Positions enable phrase queries but consume space; offsets can help highlighting. Disabling indexing or doc values requires knowing future queries. Enabling fielddata on large text fields is not a general aggregation fix: a keyword subfield is usually the appropriate model.
Mapping exposes field representations, not physical posting lists.
GET /course-products/_mappingHow to read this result
Mapping exposes field representations, not physical posting lists.
Catalog reasoning example
Take product 1, “wireless headphones”, and product 2, “wireless speaker”. wireless has [1,2], headphones has [1]. Their intersection is [1]; their union is [1,2]. Returning a name requires document values; sorting candidates by price requires numeric access. These operations use different structures. A field may therefore be returnable in JSON but unsuitable for a requested aggregation: document presence is not the same as having the required search representation.
Check your understandingCheck your understanding
Answer before expanding each explanation.
1. What is a posting list?
Documents containing a term, with optional occurrence information.
2. Why store positions?
To distinguish word order and proximity.
3. What are doc values for?
Column-oriented access for sorting, aggregations and some scripts.
4. Why is _source insufficient?
Search uses prepared structures rather than automatically scanning every JSON document.
5. What is the risk of fielddata?
High heap use when loading text field values.
Key takeaways
- Documents containing a term, with optional occurrence information.
- To distinguish word order and proximity.
- Column-oriented access for sorting, aggregations and some scripts.
- Search uses prepared structures rather than automatically scanning every JSON document.
- High heap use when loading text field values.
Official reference
Ready to put this into practice?
Confirm reading to save your place. Reading and exercise progress are tracked separately in this browser using your guest cookie.