Course contents

Inverted index and storage

Understand the structures behind fast search and how field capabilities affect storage.

4 sectionsElasticsearch 9.4.3Not read yet

What you will learn

  • From term to document
  • Different structures for different jobs
  • The cost of capabilities

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.

How it works
  • 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.

01 / 04

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 understanding
02 / 04

Different 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 understanding
03 / 04

The 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/_mapping

How to read this result

Mapping exposes field representations, not physical posting lists.

Check your understanding
04 / 04

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 understanding

Check 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.