An inverted index maps terms to the documents that contain them. Think of the index at the back of a printed book: look up a word, then follow its listed page numbers. In Elasticsearch, look up a search term, then use its associated document identifiers to retrieve matching documents. This lookup structure makes full-text retrieval fast. section 3.3 section 1.3.1
When a JSON document is indexed, each full-text field is analyzed before its terms are added to an inverted index. Analysis can remove markup, split text into tokens, and normalize those tokens. Elasticsearch creates this structure for full-text fields; numeric and geoshape data instead use BKD trees. section 3.3 section 3.7
Greeting documents
Given document 1 with greeting "Hello, WORLD" and document 2 with greeting "Hello, Mate", analysis produces lowercase terms. The index can associate hello with documents 1 and 2, world with document 1, and mate with document 2. Term frequency can also be stored alongside each term-document association. section 3.3 section 3.3
The terms stored in the index are the analyzed terms, not necessarily the original input. A title such as "The Godfather" becomes the separate lowercase tokens "the" and "godfather" under the standard analyzer. Query behavior must account for that representation. section 9.1.2
Why an exact term query can miss
A term query for "The Godfather" does not match a text-field index containing "the" and "godfather": term-level queries pass the supplied value through unchanged. A query for "godfather" can match because that exact token exists. For text search, match queries analyze search words, ordinarily using the same analyzer used at indexing time. section 9.2.2 section 10.5.3
Use an inverted index with these operational expectations:
- Index documents before searching; Elasticsearch analyzes incoming document data and stores it for faster access. section 2.1.3
- Choose analysis carefully because tokenization and normalization determine the terms queries can find. section 3.3
- Reserve term-level queries on text for exact stored terms or enumerated values; avoid them for lengthy free text. section 9.1.2
Table 3.3 Tokenized words for the “Hello, World” document (view table figure)
Inspect the term, frequency, and document-ID entries produced from a single analyzed greeting field. section 3.3




