TomonoriSoejima / Tejun

notes related to working cases
5 stars 3 forks source link

How to recover missing shards #169

Open TomonoriSoejima opened 4 months ago

TomonoriSoejima commented 4 months ago
#!/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