Bird
0
0

Given this Elasticsearch query snippet, which document will rank higher?

medium📝 Predict Output Q13 of 15
Elasticsearch - Search Results and Scoring
Given this Elasticsearch query snippet, which document will rank higher?
{
  "query": {
    "match": {
      "title": "apple"
    }
  }
}
Documents: 1. {"title": "apple pie recipe"} 2. {"title": "banana apple smoothie"} 3. {"title": "fruit salad"}
ADocument 3
BDocument 2
CDocument 1
DAll have the same score
Step-by-Step Solution
Solution:
  1. Step 1: Understand match query scoring

    Documents containing the exact term "apple" in the title get higher scores. Document 1 has "apple" at the start and is more focused.
  2. Step 2: Compare documents by term presence

    Document 1 has "apple" prominently; Document 2 has "apple" but mixed with "banana"; Document 3 lacks "apple".
  3. Final Answer:

    Document 1 -> Option C
  4. Quick Check:

    Exact term presence = higher score [OK]
Quick Trick: Exact term in title ranks higher than partial or missing [OK]
Common Mistakes:
MISTAKES
  • Assuming all documents score equally
  • Choosing document without the term
  • Ignoring term position and frequency

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes