0
0
Elasticsearchquery~5 mins

Wildcard and prefix queries in Elasticsearch - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a wildcard query in Elasticsearch?
A wildcard query searches for terms that match a pattern with special characters like * (matches any number of characters) and ? (matches a single character). It helps find words with unknown parts.
Click to reveal answer
beginner
How does a prefix query work in Elasticsearch?
A prefix query finds documents where a field's value starts with a specified string. It is like searching for all words beginning with a certain prefix.
Click to reveal answer
beginner
Which wildcard characters are used in Elasticsearch wildcard queries?
The two main wildcard characters are * which matches zero or more characters, and ? which matches exactly one character.
Click to reveal answer
intermediate
What is a key difference between wildcard and prefix queries?
Wildcard queries allow patterns anywhere in the word using * and ?, while prefix queries only match the beginning of a word with a fixed string.
Click to reveal answer
intermediate
Why should wildcard queries be used carefully in Elasticsearch?
Wildcard queries can be slow and resource-heavy because they scan many terms. Using them on large datasets or with leading wildcards (like *abc) can hurt performance.
Click to reveal answer
Which wildcard character matches exactly one character in Elasticsearch?
A?
B*
C#
D%
What does a prefix query in Elasticsearch do?
AMatches words starting with a string
BMatches words ending with a string
CMatches exact words only
DMatches any part of a word
Which query is generally faster on large datasets?
AWildcard query with leading *
BWildcard query with trailing *
CPrefix query
DWildcard query with multiple ?
Which wildcard query pattern is considered bad for performance?
Aabc*
B*abc
Cabc?def
Da?c*
In Elasticsearch, which query would you use to find all documents where a field starts with 'pre'?
AWildcard query with pattern 'pre*'
BTerm query with value 'pre'
CWildcard query with pattern '*pre'
DPrefix query with value 'pre'
Explain how wildcard and prefix queries differ in Elasticsearch and when you might use each.
Think about how flexible the search pattern is and performance.
You got /4 concepts.
    Describe the performance considerations when using wildcard queries in Elasticsearch.
    Consider how Elasticsearch searches terms internally.
    You got /4 concepts.