0
0
Elasticsearchquery~5 mins

Term query in Elasticsearch - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AExact matches of a term
BAnalyzed and tokenized words
CPartial matches
DFuzzy matches
Which field type is best suited for a Term query?
AKeyword or non-analyzed fields
BAnalyzed text fields
CNumeric fields only
DDate fields only
What will happen if you use a Term query on a text field with the value "New York"?
AIt will find documents containing "New" or "York"
BIt will analyze and split the phrase before searching
CIt will find documents with the exact phrase "New York"
DIt will not find any documents
Which query should you use instead of Term query for full-text search?
ARange query
BMatch query
CTerm query
DExists query
Is the Term query case sensitive?
ANo, it ignores case
BOnly for numeric fields
CYes, it matches exact case
DDepends on the analyzer
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.