Bird
0
0

What happens internally if you specify both includes and excludes arrays in _source filtering with overlapping fields?

hard🧠 Conceptual Q10 of 15
Elasticsearch - Search Results and Scoring
What happens internally if you specify both includes and excludes arrays in _source filtering with overlapping fields?
AIncludes takes precedence, overlapping fields are returned
BAn error is thrown due to conflict
CExcludes takes precedence, overlapping fields are not returned
DBoth includes and excludes are ignored, all fields returned
Step-by-Step Solution
Solution:
  1. Step 1: Understand precedence in source filtering

    When both includes and excludes overlap, Elasticsearch excludes those fields.
  2. Step 2: Confirm behavior

    Excludes has higher priority, so overlapping fields are omitted from the response.
  3. Final Answer:

    Excludes takes precedence, overlapping fields are not returned -> Option C
  4. Quick Check:

    Excludes overrides includes on overlap [OK]
Quick Trick: Excludes overrides includes when fields overlap [OK]
Common Mistakes:
MISTAKES
  • Assuming includes overrides excludes
  • Expecting error on overlap
  • Thinking all fields returned

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes