Complete the code to define a text field in an Elasticsearch mapping.
{
"mappings": {
"properties": {
"title": { "type": "[1]" }
}
}
}The text type is used for full-text searchable string fields in Elasticsearch.
Complete the code to define a keyword field for exact matching.
{
"mappings": {
"properties": {
"status": { "type": "[1]" }
}
}
}The keyword type is used for structured content like tags, IDs, or exact values.
Fix the error in the mapping by choosing the correct type for a date field.
{
"mappings": {
"properties": {
"created_at": { "type": "[1]" }
}
}
}The date type is used to store date and time values in Elasticsearch.
Fill both blanks to define a nested object field with a keyword subfield.
{
"mappings": {
"properties": {
"author": {
"type": "[1]",
"properties": {
"name": { "type": "[2]" }
}
}
}
}
}An object type defines a JSON object with subfields. The keyword type is used for exact matching on the subfield.
Fill all three blanks to define a mapping with a text field, a keyword subfield, and a date field.
{
"mappings": {
"properties": {
"description": {
"type": "[1]",
"fields": {
"raw": { "type": "[2]" }
}
},
"publish_date": { "type": "[3]" }
}
}
}The description is a text field for full-text search, with a keyword subfield raw for exact matching or sorting. The publish_date is a date field.