Bird
0
0

If you want to sort search results by a field that contains user names, which field type should you use in Elasticsearch mapping?

medium📝 Predict Output Q5 of 15
Elasticsearch - Mappings and Data Types
If you want to sort search results by a field that contains user names, which field type should you use in Elasticsearch mapping?
Atext
Bboolean
Cdate
Dkeyword
Step-by-Step Solution
Solution:
  1. Step 1: Understand sorting requirements

    Sorting requires exact values, not analyzed tokens.
  2. Step 2: Choose field type for sorting

    Keyword fields store exact values and support sorting; text fields do not.
  3. Final Answer:

    keyword -> Option D
  4. Quick Check:

    Sort by keyword field [OK]
Quick Trick: Sort on keyword fields, not text fields [OK]
Common Mistakes:
MISTAKES
  • Trying to sort on text fields
  • Using date or boolean for names
  • Ignoring field type for sorting

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes