0
0
Elasticsearchquery~20 mins

Custom analyzers in Elasticsearch - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Custom Analyzer Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2: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"
A["quick", "brown", "fox", "jumping"]
B["the", "quick", "brown", "fox", "jumping"]
C["quick", "brown", "fox", "is", "jumping"]
D["The", "Quick", "Brown", "Fox", "Jumping"]
Attempts:
2 left
💡 Hint
Remember that the lowercase filter converts all tokens to lowercase and the stop filter removes specified stopwords.
🧠 Conceptual
intermediate
1:30remaining
Purpose of a custom analyzer in Elasticsearch
What is the main purpose of creating a custom analyzer in Elasticsearch?
ATo store data in a custom format in Elasticsearch
BTo create custom visualizations in Kibana
CTo define a specific way to tokenize and filter text for indexing and searching
DTo manage user access and permissions
Attempts:
2 left
💡 Hint
Think about how Elasticsearch processes text for search.
🔧 Debug
advanced
2: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"]
      }
    }
  }
}
AElasticsearch will raise an error because 'nonexistent_filter' is not defined
BThe analyzer will work but ignore 'nonexistent_filter'
CThe analyzer will use the default filter instead
DThe analyzer will create a new filter named 'nonexistent_filter' automatically
Attempts:
2 left
💡 Hint
Check if all filters used in the analyzer are defined in the analysis settings.
📝 Syntax
advanced
2: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'?
A
{
  "analysis": {
    "analyzer": {
      "synonym_analyzer": {
        "type": "custom",
        "tokenizer": "standard",
        "filters": ["lowercase", "my_synonyms"]
      }
    },
    "filter": {
      "my_synonyms": {
        "type": "synonym",
        "synonyms": ["quick,fast", "jumps,leaps"]
      }
    }
  }
}
B
{
  "analysis": {
    "analyzer": {
      "synonym_analyzer": {
        "type": "custom",
        "tokenizer": "standard",
        "filter": ["lowercase", "my_synonyms"]
      }
    },
    "filter": {
      "my_synonyms": {
        "type": "synonym",
        "synonyms": ["quick,fast", "jumps,leaps"]
      }
    }
  }
}
C
{
  "analysis": {
    "analyzer": {
      "synonym_analyzer": {
        "type": "custom",
        "tokenizer": "standard",
        "filter": ["lowercase", "my_synonyms"]
      }
    },
    "filters": {
      "my_synonyms": {
        "type": "synonym",
        "synonyms": ["quick,fast", "jumps,leaps"]
      }
    }
  }
}
D
{
  "analysis": {
    "analyzer": {
      "synonym_analyzer": {
        "type": "custom",
        "tokenizer": "standard",
        "filter": ["lowercase", "my_synonyms"]
      }
    },
    "filter": {
      "my_synonyms": {
        "type": "synonym",
        "synonym": ["quick,fast", "jumps,leaps"]
      }
    }
  }
}
Attempts:
2 left
💡 Hint
Check the spelling of keys: 'filter' vs 'filters' and 'synonyms' vs 'synonym'.
🚀 Application
expert
2: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+"
      }
    }
  }
}
A7
B6
C4
D5
Attempts:
2 left
💡 Hint
The pattern tokenizer splits text by non-word characters (\W+). Count the resulting tokens after splitting.