0
0
Elasticsearchquery~20 mins

Autocomplete with edge n-gram in Elasticsearch - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Edge N-Gram Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this edge n-gram tokenizer example?
Given the following Elasticsearch analyzer configuration using edge n-gram tokenizer, what tokens will be generated for the input text "search"?
Elasticsearch
{
  "settings": {
    "analysis": {
      "tokenizer": {
        "edge_ngram_tokenizer": {
          "type": "edge_ngram",
          "min_gram": 2,
          "max_gram": 4,
          "token_chars": ["letter"]
        }
      },
      "analyzer": {
        "edge_ngram_analyzer": {
          "tokenizer": "edge_ngram_tokenizer"
        }
      }
    }
  }
}
A["se", "sea", "sear"]
B["se", "sea", "sear", "searc", "search"]
C["se", "sea", "sear", "ea", "ear", "earc", "ar", "arc", "arch", "rc", "rch", "ch"]
D["s", "se", "sea", "sear"]
Attempts:
2 left
💡 Hint
Edge n-gram tokenizer generates tokens starting from the beginning of the word with lengths between min_gram and max_gram.
🧠 Conceptual
intermediate
1:30remaining
Which option best describes the purpose of edge n-gram tokenizer in autocomplete?
What is the main reason to use an edge n-gram tokenizer in an autocomplete feature?
ATo remove stop words and reduce index size.
BTo split text into sentences for better indexing.
CTo generate tokens from the middle of words to improve search accuracy.
DTo generate tokens starting from the beginning of words to match prefixes quickly.
Attempts:
2 left
💡 Hint
Think about how autocomplete suggests words as you type from the start.
🔧 Debug
advanced
2:00remaining
Why does this edge n-gram analyzer not produce any tokens?
Given this analyzer configuration, why does the input text "hello" produce no tokens?
Elasticsearch
{
  "settings": {
    "analysis": {
      "tokenizer": {
        "my_edge_ngram": {
          "type": "edge_ngram",
          "min_gram": 3,
          "max_gram": 5,
          "token_chars": ["digit"]
        }
      },
      "analyzer": {
        "my_analyzer": {
          "tokenizer": "my_edge_ngram"
        }
      }
    }
  }
}
ABecause the min_gram is larger than the input length.
BBecause the tokenizer type is invalid.
CBecause token_chars is set to 'digit' but input contains only letters.
DBecause max_gram is less than min_gram.
Attempts:
2 left
💡 Hint
Check the token_chars setting and the input text characters.
📝 Syntax
advanced
1:30remaining
Which option correctly defines an edge n-gram tokenizer with min_gram 1 and max_gram 3?
Select the valid Elasticsearch tokenizer configuration for edge n-gram with min_gram 1 and max_gram 3.
A{ "type": "edgeNGram", "minGram": 1, "maxGram": 3 }
B{ "type": "edge_ngram", "min_gram": 1, "max_gram": 3 }
C{ "type": "edge_ngram", "minGram": 1, "maxGram": 3 }
D{ "type": "edge_ngram", "min_gram": "1", "max_gram": "3" }
Attempts:
2 left
💡 Hint
Check the correct property names and value types for edge n-gram tokenizer.
🚀 Application
expert
2:00remaining
How many tokens are generated by this edge n-gram tokenizer for input 'data'?
Given this tokenizer configuration, how many tokens will be generated for the input text "data"?
{
  "type": "edge_ngram",
  "min_gram": 1,
  "max_gram": 3,
  "token_chars": ["letter"]
}
A3
B4
C2
D1
Attempts:
2 left
💡 Hint
Count tokens starting from the first letter with lengths 1 to 3.