Complete the code to define a mapping with a text field named 'title'.
{
"mappings": {
"properties": {
"title": { "type": "[1]" }
}
}
}The text type is used for full-text searchable string fields in Elasticsearch mappings.
Complete the code to define a mapping with a date field named 'publish_date'.
{
"mappings": {
"properties": {
"publish_date": { "type": "[1]" }
}
}
}The date type is used to store date values in Elasticsearch mappings.
Fix the error in the mapping by choosing the correct type for the 'price' field.
{
"mappings": {
"properties": {
"price": { "type": "[1]" }
}
}
}The float type is used for decimal numbers like prices in Elasticsearch mappings.
Fill both blanks to define a mapping with a nested object field named 'author' having a 'name' text field.
{
"mappings": {
"properties": {
"author": {
"type": "[1]",
"properties": {
"name": { "type": "[2]" }
}
}
}
}
}The nested type allows arrays of objects, and the 'name' field is text for full-text search.
Fill all three blanks to define a mapping with a 'tags' field as keyword array and a 'views' integer field.
{
"mappings": {
"properties": {
"tags": { "type": "[1]" },
"views": { "type": "[2]" },
"active": { "type": "[3]" }
}
}
}tags use keyword for exact matches, views is an integer, and active is a boolean field.