Elasticsearch - Mappings and Data TypesWhich 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" }Check Answer
Step-by-Step SolutionSolution:Step 1: Recall Elasticsearch field typesElasticsearch uses "keyword" as the type for exact match fields.Step 2: Identify the correct syntax"keyword" is the correct type name; "text" is for analyzed fields, "string" and "fulltext" are invalid types.Final Answer:"name": { "type": "keyword" } -> Option BQuick Check:Keyword field syntax = "name": { "type": "keyword" } [OK]Quick Trick: Keyword type is exactly "keyword" in mapping [OK]Common Mistakes:MISTAKESUsing "string" instead of "keyword"Confusing "text" with "keyword"Using invalid type names like "fulltext"
Master "Mappings and Data Types" in Elasticsearch9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Elasticsearch Quizzes Basic Search Queries - Match phrase query - Quiz 8hard Basic Search Queries - Match phrase query - Quiz 3easy Document Operations - Bulk API for batch operations - Quiz 7medium Elasticsearch Basics and Architecture - First search query - Quiz 3easy Elasticsearch Basics and Architecture - Inverted index data structure - Quiz 4medium Index Management - Why indexes organize data - Quiz 6medium Index Management - Deleting and closing indexes - Quiz 6medium Mappings and Data Types - Dynamic vs explicit mapping - Quiz 7medium Search Results and Scoring - Sorting results - Quiz 12easy Search Results and Scoring - Why relevance scoring ranks results - Quiz 12easy