What does the lowercase token filter do in Elasticsearch?
The lowercase token filter converts all characters in tokens to lowercase. This helps make searches case-insensitive, so 'Apple' and 'apple' are treated the same.
Click to reveal answer
beginner
Explain the purpose of a stemmer token filter.
A stemmer token filter reduces words to their root form. For example, 'running', 'runs', and 'ran' become 'run'. This helps match different forms of a word during search.
Click to reveal answer
beginner
What is a synonym token filter used for?
A synonym token filter replaces words with their synonyms during indexing or searching. For example, 'quick' might be replaced with 'fast'. This expands search results to include similar meanings.
Click to reveal answer
intermediate
How do token filters fit into the Elasticsearch analysis process?
Token filters process tokens after the text is split by the tokenizer. They modify tokens by changing case, stemming, or adding synonyms before indexing or searching.
Click to reveal answer
intermediate
Give an example of how to define a lowercase and stemmer token filter in Elasticsearch settings.
B. "language" value is misspelled; should be "english"
C. "filter" key must be inside "analyzer"
D. Missing "synonyms" array
Solution
Step 1: Check the "language" parameter spelling
The language "englishy" is incorrect; the correct value is "english".
Step 2: Verify the stemmer type and parameters
Type "stemmer" is correct; no synonyms needed here; filter can be defined outside analyzer.
Final Answer:
"language" value is misspelled; should be "english" -> Option B
Quick Check:
Stemmer language spelling must be exact [OK]
Hint: Check spelling of language names in stemmer filters [OK]
Common Mistakes:
Using invalid language names
Confusing stemmer with synonym filter
Expecting synonyms in stemmer filter
5.
You want to create an analyzer that makes searches case-insensitive, finds root forms of words, and also matches synonyms like "fast" for "quick". Which token filters should you include in your analyzer?
hard
A. ["lowercase", "stemmer", "synonym"]
B. ["stop", "lowercase", "synonym"]
C. ["lowercase", "synonym"]
D. ["stemmer", "stop"]
Solution
Step 1: Identify filters for case-insensitivity and root forms
Lowercase filter makes tokens lowercase; stemmer finds root forms.
Step 2: Add synonym filter for matching similar words
Synonym filter adds synonyms like "fast" for "quick" to improve matching.