Bird
0
0

Which of the following is the correct way to access the _score field in an Elasticsearch search response JSON?

easy📝 Syntax Q3 of 15
Elasticsearch - Search Results and Scoring
Which of the following is the correct way to access the _score field in an Elasticsearch search response JSON?
Aresponse.hits.hits[0]._score
Bresponse.hits._score[0]
Cresponse._score.hits[0]
Dresponse.score.hits[0]
Step-by-Step Solution
Solution:
  1. Step 1: Understand Elasticsearch response structure

    Search results are inside hits.hits, each hit has a _score field.
  2. Step 2: Match correct JSON path

    response.hits.hits[0]._score correctly accesses the first hit's _score. Others have incorrect paths.
  3. Final Answer:

    response.hits.hits[0]._score -> Option A
  4. Quick Check:

    Access _score via hits.hits[index]._score [OK]
Quick Trick: Use hits.hits[index]._score to get relevance score [OK]
Common Mistakes:
MISTAKES
  • Accessing _score directly under hits
  • Swapping hits and _score order
  • Using wrong property names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes