AI Hints
Home›Elasticsearch Tutorial›Text Analysis
Elasticsearch · Lesson 52 of 120

How Analysis Works

From text to terms.

⏱ 2 min read▶ Video at 48:40🎓 Free
Watch this lesson in the Elasticsearch courseWatch on YouTube ↗Full Elasticsearch course

Before text goes into the inverted index, it's analyzed. Analysis turns a sentence into a clean list of terms. Your search text goes through the same steps, so the two can meet.

  • Text in
  • Clean terms out
  • Search matches terms

The analyzer pipeline

An analyzer has three steps. Character filters clean the raw text, like removing HTML. The tokenizer splits it into words, called tokens. Token filters change the tokens, like lower casing them. Out come the terms that get indexed.

  1. Raw text
  2. Character filters
  3. Tokenizer
  4. Token filters
  5. Terms

One example

Take the text, Storm RAIN-Jacket, with HTML bold tags. The character filter removes the tags. The tokenizer splits on the dash, giving three tokens. The lowercase filter gives storm, rain and jacket.

keyvalue
Raw<b>Storm</b> RAIN-Jacket
Char filterStorm RAIN-Jacket
TokenizerStorm | RAIN | Jacket
Lowercasestorm | rain | jacket

Summary

Analysis turns text into terms with character filters, a tokenizer, and token filters. The same happens to your search text. Next, watching it happen with the analyze API.

Key takeaways
  • Char filters
  • Tokenizer
  • Token filters
Next up: The _analyze API — see the terms