0
0
Elasticsearchquery~10 mins

Index templates in Elasticsearch - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Alogs_template
Blog_template
Ctemplate_logs
Dtemplate1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different template name than specified.
Forgetting to use PUT method.
2fill in blank
medium

Complete 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'
A*-app
Bapp-*
Capp
D*app*
Attempts:
3 left
💡 Hint
Common Mistakes
Placing the wildcard before 'app-' instead of after.
Not including the dash '-' in the pattern.
3fill in blank
hard

Fix 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'
A"two"
B"2"
Ctrue
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of a number for replicas.
Using boolean values instead of numbers.
4fill in blank
hard

Fill 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'
Adate
Btext
Cstrict_date_optional_time
Dkeyword
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text' or 'keyword' types for date fields.
Omitting the format or using incorrect format strings.
5fill in blank
hard

Fill 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'
Ametrics-*
B10
C30s
Dlogs-*
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong index pattern or missing wildcard.
Putting priority in quotes.
Setting refresh_interval without quotes.