Challenge - 5 Problems
Synonym Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this synonym filter configuration?
Given the following Elasticsearch analyzer configuration with synonyms, what tokens will be produced for the input text
"quick fox"?Elasticsearch
{
"settings": {
"analysis": {
"filter": {
"synonym_filter": {
"type": "synonym",
"synonyms": [
"quick,fast",
"fox,red fox"
]
}
},
"analyzer": {
"synonym_analyzer": {
"tokenizer": "standard",
"filter": ["lowercase", "synonym_filter"]
}
}
}
}
}
Input text: "quick fox"Attempts:
2 left
💡 Hint
Think about how synonyms expand tokens during analysis.
✗ Incorrect
The synonym filter expands each token to include its synonyms. "quick" expands to "quick" and "fast". "fox" expands to "fox" and "red fox" which tokenizes as "red" and "fox" separately.
🧠 Conceptual
intermediate1:30remaining
Which synonym type supports multi-word synonyms in Elasticsearch?
Elasticsearch supports different synonym types. Which synonym type allows you to define multi-word synonyms like "red fox" as a synonym for "fox"?
Attempts:
2 left
💡 Hint
Multi-word synonyms require special handling to preserve token positions.
✗ Incorrect
The "synonym_graph" filter supports multi-word synonyms properly by preserving token graph positions, which is necessary for phrase queries.
🔧 Debug
advanced2:00remaining
Why does this synonym filter cause a query parsing error?
Given this synonym filter snippet, why does Elasticsearch return a parsing error when indexing documents?
"synonyms": [
"fast, quick",
"fox => red fox"
]
Elasticsearch
synonyms: [ "fast, quick", "fox => red fox" ]
Attempts:
2 left
💡 Hint
Check the rules for using arrow syntax in synonym filters.
✗ Incorrect
The arrow syntax (=>) is only valid in the "synonym" filter when
expand is set to false. Without expand: false, it causes a parsing error.📝 Syntax
advanced2:00remaining
Which synonym filter configuration is syntactically correct for multi-word synonyms?
Select the correct Elasticsearch synonym filter configuration snippet that supports multi-word synonyms without errors.
Attempts:
2 left
💡 Hint
Multi-word synonyms with arrow syntax require a specific filter type.
✗ Incorrect
The "synonym_graph" filter supports multi-word synonyms and arrow syntax correctly. Option D is the only valid syntax for this case.
🚀 Application
expert2:30remaining
How many tokens are produced by this analyzer with synonyms and stop words?
Given this analyzer configuration and input text, how many tokens are produced?
Analyzer config:
{
"tokenizer": "standard",
"filter": ["lowercase", "stop_filter", "synonym_filter"]
}
Filters:
- stop_filter removes: "the", "a"
- synonym_filter synonyms:
"quick,fast"
"fox,red fox"
Input text: "The quick brown fox jumps over a lazy dog"
Attempts:
2 left
💡 Hint
Count tokens after stop word removal and synonym expansion.
✗ Incorrect
Stop words "the" and "a" are removed, leaving 7 tokens. "quick" expands to 2 tokens (+1 extra). "fox" expands to "fox", "red", "fox" (3 tokens, +2 extra). Total tokens: 7 + 1 + 2 = 10.