Challenge - 5 Problems
Custom Analyzer Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of a custom analyzer with lowercase and stop filters
Given the following Elasticsearch analyzer configuration and input text, what is the output tokens after analysis?
Elasticsearch
{
"analysis": {
"analyzer": {
"my_custom_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase", "stop"]
}
},
"filter": {
"stop": {
"type": "stop",
"stopwords": ["the", "is"]
}
}
}
}
Input text: "The Quick Brown Fox is Jumping"Attempts:
2 left
💡 Hint
Remember that the lowercase filter converts all tokens to lowercase and the stop filter removes specified stopwords.
✗ Incorrect
The tokenizer splits the text into tokens. The lowercase filter converts all tokens to lowercase. The stop filter removes the words "the" and "is". So the output tokens are ["quick", "brown", "fox", "jumping"].
🧠 Conceptual
intermediate1:30remaining
Purpose of a custom analyzer in Elasticsearch
What is the main purpose of creating a custom analyzer in Elasticsearch?
Attempts:
2 left
💡 Hint
Think about how Elasticsearch processes text for search.
✗ Incorrect
Custom analyzers let you control how text is broken into tokens and how those tokens are filtered before indexing and searching, improving search relevance.
🔧 Debug
advanced2:00remaining
Identify the error in this custom analyzer configuration
What error will occur when trying to create this analyzer in Elasticsearch?
Elasticsearch
{
"analysis": {
"analyzer": {
"my_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase", "nonexistent_filter"]
}
}
}
}Attempts:
2 left
💡 Hint
Check if all filters used in the analyzer are defined in the analysis settings.
✗ Incorrect
Elasticsearch requires all filters used in an analyzer to be defined. Using an undefined filter causes an error.
📝 Syntax
advanced2:30remaining
Correct syntax for defining a custom analyzer with a synonym filter
Which option correctly defines a custom analyzer that uses a synonym filter named 'my_synonyms'?
Attempts:
2 left
💡 Hint
Check the spelling of keys: 'filter' vs 'filters' and 'synonyms' vs 'synonym'.
✗ Incorrect
The correct key for filters is 'filter' (singular) inside the analyzer. The filter definitions must be under 'filter' (not 'filters'). The synonym filter requires the key 'synonyms' (plural) for the list of synonyms.
🚀 Application
expert2:30remaining
Number of tokens produced by a custom analyzer with pattern tokenizer and lowercase filter
Given this custom analyzer configuration, how many tokens will be produced when analyzing the text "Hello, World! Welcome to Elasticsearch."?
Elasticsearch
{
"analysis": {
"analyzer": {
"pattern_analyzer": {
"type": "custom",
"tokenizer": "pattern",
"filter": ["lowercase"]
}
},
"tokenizer": {
"pattern": {
"type": "pattern",
"pattern": "\\W+"
}
}
}
}Attempts:
2 left
💡 Hint
The pattern tokenizer splits text by non-word characters (\W+). Count the resulting tokens after splitting.
✗ Incorrect
The pattern '\\W+' splits on any sequence of non-word characters. The text splits into: ['Hello', 'World', 'Welcome', 'to', 'Elasticsearch']. After lowercase filter, tokens remain the same count. So total tokens = 5.