Recall & Review
beginner
What is a Dis max query in Elasticsearch?
A Dis max query is a type of query that runs multiple queries and returns the highest score from any of them. It helps find the best matching documents when searching across multiple fields.
Click to reveal answer
intermediate
How does the Dis max query combine scores from multiple queries?
It takes the maximum score from all the queries and optionally adds a tie breaker score from the other queries multiplied by a tie_breaker parameter.
Click to reveal answer
intermediate
What is the purpose of the tie_breaker parameter in a Dis max query?
The tie_breaker parameter adds a fraction of the scores from the other queries to the maximum score, helping to boost documents that match multiple queries slightly.
Click to reveal answer
beginner
Write a simple Dis max query that searches for 'apple' in two fields: 'title' and 'description'.
{
"dis_max": {
"queries": [
{ "match": { "title": "apple" } },
{ "match": { "description": "apple" } }
]
}
}
Click to reveal answer
intermediate
Why might you choose a Dis max query over a bool 'should' query with multiple matches?
Because Dis max returns the highest score from the queries, it avoids boosting documents that match multiple fields too much, which can be useful when you want the best single match rather than cumulative matches.
Click to reveal answer
What does a Dis max query return when multiple queries match a document?
✗ Incorrect
A Dis max query returns the maximum score from all the queries it runs.
What is the default value of the tie_breaker parameter in a Dis max query?
✗ Incorrect
The default tie_breaker value is 0.0, meaning no additional score from other queries is added.
Which Elasticsearch query type is best when you want to combine scores by taking the maximum?
✗ Incorrect
Dis max query combines multiple queries by taking the maximum score.
If you want to slightly boost documents matching multiple queries in a Dis max query, which parameter do you adjust?
✗ Incorrect
The tie_breaker parameter controls how much scores from other queries add to the max score.
Which of these is NOT a feature of the Dis max query?
✗ Incorrect
Dis max query does not combine queries using AND logic; it picks the max score.
Explain how a Dis max query works and when you would use it.
Think about searching in several places and picking the best match.
You got /4 concepts.
Describe the difference between a Dis max query and a bool 'should' query in Elasticsearch.
Consider how scores are combined and what effect that has.
You got /4 concepts.