<p dir="auto"><strong>Elasticsearch version</strong>: 1.7.5</p>
<p dir="auto"><strong>Description of the problem including expected versus actual behavior</strong>:</p>
<p dir="auto">The following is a scenario where the allocation algorithm today can leave shards unassigned and requires manual intervention to reroute/swap shards between nodes for it to fully allocate the shards for an index:  <a href="https://gist.github.com/ppf2/9a005e26e156c7e0face9c4b3d27c4d9">https://gist.github.com/ppf2/9a005e26e156c7e0face9c4b3d27c4d9</a></p>
<p dir="auto">It will be great if there is a way for the allocation algorithm to be able to "look ahead" and try moving a different shard away to see if it helps with the allocation until it is able to fully allocate the shards - without requiring manual intervention by admins.</p>
<p dir="auto">This test uses a similar setup as 14010 (also using ES 1.7.2), the only difference is that for this use case, only 1 of the attributes (updateDomain) is set to be forced, the other attribute (faultDomain) is not set to be forced.</p>
<p dir="auto">With this configuration, you will see from the video that the first issue I ran into is 14010 where I have to prod it by forcing a cluster reroute in order for it to complete its allocation.  Except that even after prodding, one of the shard is not at the right place.  If I use a manual reroute command to move it, it actually gets moved successfully and does not violate any routing rules.  Given that it does not violate any routing rules, it seems like there is another bug here where it is not moving the shard to the right place automatically as part of awareness.</p>
<p dir="auto">Repro video:<br>
<a href="https://drive.google.com/file/d/0B1rxJ0dAZbQvd3p5Y3F0QzItMWs/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B1rxJ0dAZbQvd3p5Y3F0QzItMWs/view?usp=sharing</a></p>
<p dir="auto">Node setup:<br>
<a href="https://docs.google.com/document/d/1ktYSzaZh_FlhloSextzCNh3HYYS0OEE8wPU4jhHGPTo/edit?usp=sharing" rel="nofollow">https://docs.google.com/document/d/1ktYSzaZh_FlhloSextzCNh3HYYS0OEE8wPU4jhHGPTo/edit?usp=sharing</a></p>