Reference · Cheat sheet

Analysis & the term-mismatch trap

The compressed essence. Print it, pin it.

From lesson 0003See also glossary

The pipeline (always this order)

char filters → tokenizer → token filters → terms

StageCountDoesExamples
char filters0+rewrite raw charactershtml_strip, mapping
tokenizerexactly 1split into tokensstandard, whitespace, edge_ngram
token filters0+add / remove / change tokenslowercase, stop, stemmer, synonym

standard analyzer = standard tokenizer + lowercase. "The Quick-Brown Fox"thequickbrownfox

Analysis runs twice

text vs keyword

TypeAnalyzed?StoredUse for
textyesmany tokensmatch full-text search
keywordno (verbatim)one exact termexact match, sort, aggregations

Dynamic string mapping → both: a text field and a .keyword sub-field.

The trap

One rule

match analyzes its input · term does not (verbatim lookup).

SymptomCauseFix
term on text → 0 hitsquery not analyzed, field was (case/split differ)use match, or term on .keyword
match on keyword → 0 hitsfield not analyzed, stores whole stringmatch the full value, or map as text

Debugging

POST /_analyze                       // what tokens does this analyzer emit?
{ "analyzer": "standard", "text": "The Quick-Brown Fox" }

POST /index/_analyze                 // use a specific field's mapped analyzer
{ "field": "title", "text": "Elasticsearch" }

GET /index/_mapping                  // is the field text or keyword?

← lesson 0003 · Source: Analyzer reference (Elastic Docs)