A Boosting query lets you increase the score of documents matching a positive query and decrease the score of documents matching a negative query, helping to rank results better.
Click to reveal answer
beginner
Which two main parts does a Boosting query have?
A Boosting query has a positive query to match preferred documents and a negative query to match documents to downrank.
Click to reveal answer
intermediate
What does the 'negative_boost' parameter do in a Boosting query?
The 'negative_boost' parameter reduces the score of documents matching the negative query by multiplying their score by this value (less than 1).
Click to reveal answer
beginner
How would you describe the effect of a Boosting query using a real-life example?
Imagine searching for 'apple' but you want to show fruit results higher and downrank results about the company Apple. The Boosting query boosts fruit matches and lowers company matches.
Click to reveal answer
intermediate
Show a simple JSON example of a Boosting query that boosts 'apple' fruit and downranks 'apple' company.
The correct syntax uses the "boosting" key with "positive", "negative", and "negative_boost" fields.
Step 2: Check each option
The snippet using "boosting" with "positive" match query, "negative" match query, and "negative_boost": 0.5 matches the correct structure. Others miss "negative_boost" or use incorrect keys like "boost" or "boosting_query".
D. Positive and negative queries cannot use the same field
Solution
Step 1: Check required fields in boosting query
A boosting query requires "positive", "negative", and "negative_boost" fields to work correctly.
Step 2: Identify missing element
The provided query lacks the "negative_boost" field, which defines how much to reduce negative matches.
Final Answer:
Missing "negative_boost" field -> Option A
Quick Check:
Boosting query needs negative_boost [OK]
Hint: Always include negative_boost in boosting queries [OK]
Common Mistakes:
Omitting negative_boost
Using wrong key names
Assuming same field usage is invalid
5. You want to boost documents containing "premium" in the category field and reduce scores of documents containing "basic" in the same field by half. Which boosting query correctly achieves this?
Positive query should match "premium" category to boost, negative query should match "basic" to reduce score.
Step 2: Check negative_boost value
Negative boost of 0.5 reduces scores of negative matches by half, which matches the requirement.
Step 3: Verify options
{ "boosting": { "positive": { "term": { "category": "premium" } }, "negative": { "term": { "category": "basic" } }, "negative_boost": 0.5 } } correctly uses term queries and negative_boost 0.5. Other options either use negative_boost greater than 1, are not boosting queries, or reverse positive and negative.