0
0
Elasticsearchquery~10 mins

Why templates standardize index creation in Elasticsearch - Test Your Understanding

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

Complete the code to define a template that applies to all indices starting with 'logs-'.

Elasticsearch
{
  "index_patterns": ["[1]"],
  "settings": {
    "number_of_shards": 1
  }
}
Drag options to blanks, or click blank then click option'
A*-logs
Blog-*
Clogs
Dlogs-*
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'log-*' which misses the 's' in 'logs'.
Using 'logs' without wildcard, which matches only one index.
Using '*-logs' which matches indices ending with '-logs'.
2fill in blank
medium

Complete 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'
A2
B3
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Setting replicas to 0 disables redundancy.
Setting replicas to 1 only creates one copy, not two.
3fill in blank
hard

Fix the error in the template mapping by completing the field type for 'timestamp'.

Elasticsearch
"mappings": {
  "properties": {
    "timestamp": { "type": "[1]" }
  }
}
Drag options to blanks, or click blank then click option'
Ainteger
Btext
Cdate
Dkeyword
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text' which is for full text search, not dates.
Using 'keyword' which is for exact string matches.
Using 'integer' which is for numbers, not dates.
4fill in blank
hard

Fill both blanks to create a template that applies to indices starting with 'app-' and sets refresh interval to 30s.

Elasticsearch
{
  "index_patterns": ["[1]"],
  "settings": {
    "refresh_interval": "[2]"
  }
}
Drag options to blanks, or click blank then click option'
Aapp-*
B60s
C30s
Dapp
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'app' without wildcard matches only one index.
Setting refresh interval to '60s' instead of '30s'.
5fill in blank
hard

Fill all three blanks to define a template with pattern 'metrics-*', 3 shards, and mapping type 'keyword' for 'host'.

Elasticsearch
{
  "index_patterns": ["[1]"],
  "settings": {
    "number_of_shards": [2]
  },
  "mappings": {
    "properties": {
      "host": { "type": "[3]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Ametrics-*
B3
Ckeyword
Dtext
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text' instead of 'keyword' for 'host' field.
Setting shards to 1 or 5 instead of 3.
Using wrong index pattern without wildcard.