Thinking replicas default to 0 if not set elsewhere
Confusing component template with index data
4. You tried to create a component template but got an error. Which of these is the most likely cause?
PUT /_component_template/my_template
{
"settings": {
"number_of_shards": 3
}
}
medium
A. Using PUT instead of POST
B. number_of_shards cannot be set in component templates
C. Incorrect endpoint; should be /_index_template
D. Missing the 'template' wrapper around settings
Solution
Step 1: Check JSON structure for component template
Component templates require a template key wrapping settings and mappings.
Step 2: Identify missing wrapper
The request body lacks the "template" object, causing the error.
Final Answer:
Missing the 'template' wrapper around settings -> Option D
Quick Check:
Component template body must have 'template' key [OK]
Hint: Always wrap settings inside 'template' in component templates [OK]
Common Mistakes:
Omitting the 'template' key in JSON body
Confusing component template endpoint with index template
Thinking PUT is wrong method for creation
5. You want to create an index template that uses two component templates: one for settings and one for mappings. Which is the correct way to reference both component templates in the index template?