#!/bin/bash
# Read the file line by line
while read -r index; do
# Print the curl command with the current index from the file using printf
printf 'curl -X POST "https://localhost:9200/_cluster/reroute" -u "username:password" -H "Content-Type: application/json" -d '"'"'{
"commands": [
{
"allocate_empty_primary": {
"index": "%s",
"shard": 0,
"node": "elasticsearch-dna-data-0",
"accept_data_loss": true
}
}
]
}'"'"'\n' "$index"
done < list