Complete the code to define a dynamic template that matches all string fields.
{
"mappings": {
"dynamic_templates": [
{
"strings_as_keywords": {
"match_mapping_type": "[1]",
"mapping": {
"type": "keyword"
}
}
}
]
}
}The match_mapping_type for string fields is string in dynamic templates.
Complete the code to apply a dynamic template only to fields matching the pattern 'user_*'.
{
"mappings": {
"dynamic_templates": [
{
"user_fields": {
"match": "[1]",
"mapping": {
"type": "text"
}
}
}
]
}
}The match pattern uses wildcard syntax, so user_* matches all fields starting with 'user_'.
Fix the error in the dynamic template to set the type to 'date' for fields matching 'date_*'.
{
"mappings": {
"dynamic_templates": [
{
"dates": {
"match": "date_*",
"mapping": {
"type": "[1]"
}
}
}
]
}
}The correct Elasticsearch field type for dates is date.
Fill both blanks to create a dynamic template that maps all numeric fields to type 'long' and disables indexing.
{
"mappings": {
"dynamic_templates": [
{
"long_numbers": {
"match_mapping_type": "[1]",
"mapping": {
"type": "[2]",
"index": false
}
}
}
]
}
}The match_mapping_type for long numbers is long, and the field type should also be set to long.
Fill all three blanks to create a dynamic template that matches fields ending with '_txt', maps them as 'text' type with 'english' analyzer, and disables norms.
{
"mappings": {
"dynamic_templates": [
{
"text_fields": {
"match": "[1]",
"mapping": {
"type": "[2]",
"analyzer": "[3]",
"norms": false
}
}
}
]
}
}The match pattern *_txt matches fields ending with '_txt'. The type is text with the english analyzer and norms disabled.