Recall & Review
beginner
What is a Term query in Elasticsearch?
A Term query searches for exact matches of a term in a field. It does not analyze the search term, so it looks for the exact value as stored.
Click to reveal answer
beginner
How does a Term query differ from a Match query?
A Term query looks for exact values without analyzing the input, while a Match query analyzes the input text (like splitting words) before searching.
Click to reveal answer
beginner
Show a simple example of a Term query searching for the value "blue" in the field "color".
{
"term": {
"color": {
"value": "blue"
}
}
}
Click to reveal answer
intermediate
Can a Term query be used to search text fields that are analyzed?
No, Term queries work best on keyword or non-analyzed fields because they look for exact matches. For analyzed text fields, use Match queries.
Click to reveal answer
intermediate
What happens if you use a Term query on a text field with multiple words?
The Term query will look for the exact whole string including spaces. It won't split the words, so it may not find matches if the field is analyzed.
Click to reveal answer
What does a Term query in Elasticsearch search for?
✗ Incorrect
A Term query searches for exact matches of the term without analyzing it.
Which field type is best suited for a Term query?
✗ Incorrect
Term queries work best on keyword or non-analyzed fields because they look for exact values.
What will happen if you use a Term query on a text field with the value "New York"?
✗ Incorrect
On an analyzed text field, "New York" is tokenized into separate terms (e.g., "new", "york"). A term query looks for the exact unanalyzed term "New York", which doesn't exist in the index.
Which query should you use instead of Term query for full-text search?
✗ Incorrect
Match query analyzes the text and is better for full-text search.
Is the Term query case sensitive?
✗ Incorrect
Term query matches the exact term including case.
Explain what a Term query is and when you would use it in Elasticsearch.
Think about searching for exact values like IDs or keywords.
You got /5 concepts.
Describe the difference between Term query and Match query in Elasticsearch.
Consider how the input text is treated before searching.
You got /4 concepts.