Challenge - 5 Problems
Match Query Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Match query?
Given the following Elasticsearch Match query, what documents will be matched if the index contains documents with the field
1. "Quick brown fox"
2. "Brown fox jumps"
3. "Lazy dog"
Query:
title having values: 1. "Quick brown fox"
2. "Brown fox jumps"
3. "Lazy dog"
Query:
{"query": {"match": {"title": "brown fox"}}}Elasticsearch
{"query": {"match": {"title": "brown fox"}}}Attempts:
2 left
💡 Hint
Match query analyzes the input text and looks for documents containing any of the terms after analysis.
✗ Incorrect
The match query analyzes the input 'brown fox' into terms 'brown' and 'fox'. Documents 1 and 2 contain both terms, so they match. Document 3 does not contain either term.
🧠 Conceptual
intermediate1:30remaining
How does the operator parameter affect a Match query?
In an Elasticsearch Match query, what is the effect of setting the
operator parameter to and instead of the default or?Attempts:
2 left
💡 Hint
Think about how 'and' changes the condition from 'any' to 'all'.
✗ Incorrect
Setting operator to 'and' means all terms must be present in the document for it to match. The default 'or' matches if any term is present.
🔧 Debug
advanced2:30remaining
Why does this Match query return no results?
Consider this Match query:
Given documents:
1. {"description": "fast and agile"}
2. {"description": "runner and jumper"}
3. {"description": "fast runner"}
Why does the query return only document 3?
{"query": {"match": {"description": {"query": "fast runner", "operator": "and"}}}}Given documents:
1. {"description": "fast and agile"}
2. {"description": "runner and jumper"}
3. {"description": "fast runner"}
Why does the query return only document 3?
Attempts:
2 left
💡 Hint
Check how the 'and' operator affects term matching in documents.
✗ Incorrect
The 'and' operator requires all terms to be present. Documents 1 and 2 have only one of the terms each, so they don't match. Document 3 has both terms.
📝 Syntax
advanced1:30remaining
Identify the syntax error in this Match query
Which option contains a syntax error in the Elasticsearch Match query?
Attempts:
2 left
💡 Hint
Check the quotes around string values in JSON.
✗ Incorrect
Option D is invalid JSON because the value or is not quoted, causing a syntax error.
🚀 Application
expert3:00remaining
Which Match query option produces exactly 2 matched documents?
Given an index with documents:
1. {"text": "apple banana cherry"}
2. {"text": "banana cherry"}
3. {"text": "apple cherry"}
4. {"text": "banana apple"}
Which Match query will match exactly documents 1 and 3?
1. {"text": "apple banana cherry"}
2. {"text": "banana cherry"}
3. {"text": "apple cherry"}
4. {"text": "banana apple"}
Which Match query will match exactly documents 1 and 3?
Attempts:
2 left
💡 Hint
Look for documents containing both 'apple' and 'cherry'.
✗ Incorrect
Option A matches documents containing both 'apple' and 'cherry' which are documents 1 and 3 only.