Elastic search cluster shards are not recover version is 1.7

Yes, what every you have mentioned is current statements. I wrote one shell script to force recover the shards. After executed my script out of 184 unassigned shards its showing pending 120 shards. Please find the script..
#!/bin/bash
OLDIFS=$IFS
IFS=$'\n'

curl http://localhost:9202/_cat/shards | grep UNASSIGNED | sort > unassigned
for shard in cat unassigned;
do
index=echo $shard | awk '{print $1}'
lostshard=echo $shard | awk '{print $2}'
#echo "$index and $lostshard"

curl -XPOST 'localhost:9201/_cluster/reroute' -d "{ "commands" : [ { "allocate" : { "index" : "$index", "shard" : $lostshard, "node": "master-node-name", "allow_primary": "true" } }] }"

done

IFS=$OLDIFS

Now I am getting the below error is

{"error":"ElasticsearchIllegalArgumentException[[allocate] allocation of [index_name][8] on node [node_name][thhPJF__Q4-aTzt6un4E9A][data_node][inet[/data_node:9302]]{tag=source01-data1-data-node, master=false} is not allowed, reason: [YES(shard is not allocated to same node or host)][NO(node does not match index include filters [tag:"source02*"])][YES(shard is primary)][YES(below primary recovery limit of [4])][YES(allocation disabling is ignored)][YES(allocation disabling is ignored)][YES(no allocation awareness enabled)][YES(total shard limit disabled: [-1] <= 0)][YES(primary shard can be allocated anywhere)][YES(enough disk for shard on node, free: [1.2tb])][YES(no snapshots are currently running)]]","status":400}. Please find the status.

{
"cluster_name": "XYZ cluster name",
"status": "red",
"timed_out": false,
"number_of_nodes": 50,
"number_of_data_nodes": 36,
"active_primary_shards": 2112,
"active_shards": 2112,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 120,
"delayed_unassigned_shards": 0,
"number_of_pending_tasks": 0,
"number_of_in_flight_fetch": 0
}