Bird
0
0

What will happen if you add pre_tags and post_tags in the highlight section like this?

medium📝 Predict Output Q5 of 15
Elasticsearch - Search Results and Scoring
What will happen if you add pre_tags and post_tags in the highlight section like this?
"highlight": {"fields": {"content": {}}, "pre_tags": [""], "post_tags": [""]}
AThe entire content field will be wrapped with <em> and </em> tags.
BThe query will ignore pre_tags and post_tags and use default tags.
CMatched text in content will be wrapped with <em> and </em> tags.
DThe query will fail due to invalid tag syntax.
Step-by-Step Solution
Solution:
  1. Step 1: Understand pre_tags and post_tags usage

    These tags define how matched text is wrapped in the highlight output.
  2. Step 2: Predict effect on matched text

    Matched parts in content will be wrapped with and as specified.
  3. Final Answer:

    Matched text in content will be wrapped with <em> and </em> tags. -> Option C
  4. Quick Check:

    pre_tags/post_tags wrap matched text [OK]
Quick Trick: Use pre_tags/post_tags to customize highlight wrappers [OK]
Common Mistakes:
MISTAKES
  • Thinking tags apply to whole field
  • Assuming tags are ignored
  • Using invalid tag syntax causing errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes