Bird
0
0

Which of the following is the correct way to define a keyword field in an Elasticsearch mapping?

easy📝 Syntax Q12 of 15
Elasticsearch - Mappings and Data Types
Which of the following is the correct way to define a keyword field in an Elasticsearch mapping?
A"name": { "type": "text" }
B"name": { "type": "keyword" }
C"name": { "type": "string" }
D"name": { "type": "fulltext" }
Step-by-Step Solution
Solution:
  1. Step 1: Recall Elasticsearch field types

    Elasticsearch uses "keyword" as the type for exact match fields.
  2. Step 2: Identify the correct syntax

    "keyword" is the correct type name; "text" is for analyzed fields, "string" and "fulltext" are invalid types.
  3. Final Answer:

    "name": { "type": "keyword" } -> Option B
  4. Quick Check:

    Keyword field syntax = "name": { "type": "keyword" } [OK]
Quick Trick: Keyword type is exactly "keyword" in mapping [OK]
Common Mistakes:
MISTAKES
  • Using "string" instead of "keyword"
  • Confusing "text" with "keyword"
  • Using invalid type names like "fulltext"

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes