Bird
0
0

How can you use source filtering to return only nested fields like comments.text and comments.date in the search response?

hard🚀 Application Q9 of 15
Elasticsearch - Search Results and Scoring
How can you use source filtering to return only nested fields like comments.text and comments.date in the search response?
A{"fields": ["comments.text", "comments.date"]}
B{"_source": {"includes": ["comments.text", "comments.date"]}}
C{"_source": false}
D{"_source": {"excludes": ["comments"]}}
Step-by-Step Solution
Solution:
  1. Step 1: Use dot notation for nested fields

    Nested fields are specified using dot notation inside the includes array.
  2. Step 2: Confirm correct source filtering syntax

    {"_source": {"includes": ["comments.text", "comments.date"]}} correctly includes only the nested fields comments.text and comments.date.
  3. Final Answer:

    {"_source": {"includes": ["comments.text", "comments.date"]}} -> Option B
  4. Quick Check:

    Use dot notation in includes array for nested fields [OK]
Quick Trick: Use dot notation in includes array for nested fields [OK]
Common Mistakes:
MISTAKES
  • Using excludes to remove nested fields
  • Setting _source false
  • Using fields key instead of _source

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes