Bird
0
0

You want to return all fields except password and credit_card, but also explicitly include only name and email. Which _source filter configuration achieves this?

hard🚀 Application Q8 of 15
Elasticsearch - Search Results and Scoring
You want to return all fields except password and credit_card, but also explicitly include only name and email. Which _source filter configuration achieves this?
A{"_source": {"includes": ["name", "email"], "excludes": ["password", "credit_card"]}}
B{"_source": {"includes": ["name", "email", "password", "credit_card"]}}
C{"_source": {"excludes": ["password", "credit_card"]}}
D{"_source": false}
Step-by-Step Solution
Solution:
  1. Step 1: Understand includes and excludes

    Includes specify fields to return, excludes specify fields to omit.
  2. Step 2: Analyze requirement

    Return only name and email but exclude password and credit_card. Using both includes and excludes together filters accordingly.
  3. Step 3: Evaluate options

    {"_source": {"includes": ["name", "email"], "excludes": ["password", "credit_card"]}} correctly combines includes and excludes. {"_source": {"includes": ["name", "email", "password", "credit_card"]}} includes sensitive fields. {"_source": {"excludes": ["password", "credit_card"]}} returns all except excluded but does not restrict to name and email. {"_source": false} disables source entirely.
  4. Final Answer:

    Option A -> Option A
  5. Quick Check:

    Use both includes and excludes arrays to filter precisely [OK]
Quick Trick: Combine includes and excludes arrays for precise filtering [OK]
Common Mistakes:
MISTAKES
  • Using only excludes when includes are needed
  • Including sensitive fields by mistake
  • Setting _source to false disables all fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes