But new indexes named app-logs are created with 5 shards instead of 3. What is the likely problem?
medium
A. The template was created after the indexes were created.
B. The index name does not match the pattern "app-*".
C. The setting "number_of_shards" cannot be set by templates.
D. The template JSON syntax is invalid.
Solution
Step 1: Understand when templates apply
Templates apply only when an index is created. Existing indexes keep their original settings.
Step 2: Check index creation timing
If indexes were created before the template, they won't have the template's shard settings.
Final Answer:
The template was created after the indexes were created. -> Option A
Quick Check:
Templates affect new indexes only [OK]
Hint: Templates apply only at index creation time [OK]
Common Mistakes:
Thinking templates update existing indexes
Assuming pattern mismatch without checking
Believing shard count can't be set in templates
5. You want to ensure all indexes starting with user-data- have the same mapping for a username field as keyword type and 1 shard. Which template JSON correctly achieves this?