Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create an index template named 'logs_template'.
Elasticsearch
PUT _index_template/[1] { "index_patterns": ["logs-*"], "template": { "settings": { "number_of_shards": 1 } } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different template name than specified.
Forgetting to use PUT method.
✗ Incorrect
The index template name is 'logs_template' as specified in the task.
2fill in blank
mediumComplete the code to set the index pattern to match all indices starting with 'app-'.
Elasticsearch
"index_patterns": ["[1]"]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Placing the wildcard before 'app-' instead of after.
Not including the dash '-' in the pattern.
✗ Incorrect
The pattern 'app-*' matches all indices starting with 'app-'.
3fill in blank
hardFix the error in the code to set the number of replicas to 2 in the template settings.
Elasticsearch
"settings": { "number_of_replicas": [1] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of a number for replicas.
Using boolean values instead of numbers.
✗ Incorrect
The number_of_replicas setting expects an integer value, so 2 without quotes is correct.
4fill in blank
hardFill both blanks to add a mapping for a 'timestamp' field of type 'date'.
Elasticsearch
"mappings": { "properties": { "timestamp": { "type": "[1]", "format": "[2]" } } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text' or 'keyword' types for date fields.
Omitting the format or using incorrect format strings.
✗ Incorrect
The 'timestamp' field should be of type 'date' with format 'strict_date_optional_time' for proper date parsing.
5fill in blank
hardFill all three blanks to create a template with priority 10, matching indices starting with 'metrics-', and setting refresh interval to 30s.
Elasticsearch
{
"index_patterns": ["[1]"],
"priority": [2],
"template": {
"settings": {
"refresh_interval": "[3]"
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong index pattern or missing wildcard.
Putting priority in quotes.
Setting refresh_interval without quotes.
✗ Incorrect
The index pattern is 'metrics-*', priority is 10 as a number, and refresh_interval is '30s' as a string.