Challenge - 5 Problems
Elasticsearch Relevance Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the _score of a match query with exact term match?
Given the following Elasticsearch query, what will be the _score of the matched document relative to a document that does not contain the term?
Elasticsearch
{
"query": {
"match": {
"title": "Elasticsearch"
}
}
}Attempts:
2 left
💡 Hint
Think about how Elasticsearch scores documents based on term frequency and inverse document frequency.
✗ Incorrect
Elasticsearch assigns a positive _score to documents matching the query. The score reflects how well the document matches the query terms. Documents without the term get no score or zero relevance.
🧠 Conceptual
intermediate2:00remaining
How does Elasticsearch calculate the _score for a multi-match query?
In Elasticsearch, when you use a multi-match query across multiple fields, how is the _score for each document computed?
Attempts:
2 left
💡 Hint
Consider how relevance from multiple fields contributes to the overall score.
✗ Incorrect
The multi-match query calculates the _score by summing the scores from each field where the query matches, reflecting combined relevance.
🔧 Debug
advanced2:00remaining
Why does this bool query always return zero _score?
Examine the following Elasticsearch query. Why does it always return documents with _score equal to zero?
Elasticsearch
{
"query": {
"bool": {
"filter": [
{ "term": { "status": "active" } },
{ "term": { "category": "books" } }
]
}
}
}Attempts:
2 left
💡 Hint
Think about the difference between filter and must clauses in bool queries.
✗ Incorrect
Filters are used for yes/no matching and do not calculate relevance scores, so documents matched by filters have _score zero.
📝 Syntax
advanced2:00remaining
Which query syntax correctly boosts the _score of documents matching 'python'?
Select the Elasticsearch query syntax that correctly boosts the _score of documents containing the term 'python' in the 'description' field.
Attempts:
2 left
💡 Hint
Check the correct placement of the boost parameter inside the match query object.
✗ Incorrect
The boost parameter must be inside the field object along with the query key. Option D correctly places boost inside the description object.
🚀 Application
expert3:00remaining
How to combine function_score with match query to boost recent documents?
You want to boost the _score of documents matching 'data science' in the 'content' field, but also boost documents published in the last 30 days. Which Elasticsearch query achieves this?
Attempts:
2 left
💡 Hint
Use function_score to combine query relevance with custom boosting based on a filter.
✗ Incorrect
Option A uses function_score with a match query and a function that boosts documents published in the last 30 days by weight 3, multiplying the scores.