Bird
0
0

You want to return all fields except password and ssn from documents, but also include only the name and email fields explicitly. Which source filtering configuration achieves this correctly?

hard🚀 Application Q15 of 15
Elasticsearch - Search Results and Scoring
You want to return all fields except password and ssn from documents, but also include only the name and email fields explicitly. Which source filtering configuration achieves this correctly?
A"_source": { "includes": ["name", "email"], "excludes": ["password", "ssn"] }
B"_source": { "include": ["name", "email", "password", "ssn"] }
C"_source": { "exclude": ["password", "ssn"] }
D"_source": { "include": ["name", "email"] }
Step-by-Step Solution
Solution:
  1. Step 1: Understand combined includes and excludes

    Using both includes and excludes lets you specify fields to return and fields to omit.
  2. Step 2: Analyze options

    "_source": { "includes": ["name", "email"], "excludes": ["password", "ssn"] } includes name and email but excludes password and ssn, matching the requirement.
  3. Final Answer:

    "_source": { "includes": ["name", "email"], "excludes": ["password", "ssn"] } -> Option A
  4. Quick Check:

    includes + excludes together filters fields precisely [OK]
Quick Trick: Combine includes and excludes to fine-tune returned fields [OK]
Common Mistakes:
MISTAKES
  • Using only includes or excludes, missing fields
  • Including fields meant to be excluded
  • Misunderstanding combined filtering behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes