<p dir="auto">I am trying to get index templates working properly but I want to include them in my configuration. I have added lots of logging to the code and I see the following:</p>
<ol dir="auto">
<li>When I index something that should match a template I see ES go looking for matching templates. However none ever match.</li>
<li>All template objects return null when calling the template method.</li>
</ol>
<p dir="auto">The cause of the problem seems to be the parsing in the "fromXContent()" method in "IndexTemplateMetadata.Builder". The field it starts with is the template name but it proceeds to the next token without storing it in the template object that is being built.</p>
<p dir="auto">Duplicating the "template" field makes it work:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
    &quot;template&quot; : &quot;my_template&quot;,
    &quot;order&quot; : 2,
    &quot;template&quot; : &quot;my_template&quot;,
    &quot;settings&quot; : {
    ..."><pre class="notranslate"><code class="notranslate">{
    "template" : "my_template",
    "order" : 2,
    "template" : "my_template",
    "settings" : {
    ...
</code></pre></div>
<p dir="auto">As a stopgap to index-based allocation, could offer an API to move a shard to a specific node.</p>
<p dir="auto">This can be used to move large shards to specific nodes, then let smaller shards reallocate around them.</p>
<p dir="auto">A plugin like elasticsearch-head could let you drag &amp; drop a shard to a node to manually rebalance.</p>