Verificar tamanho de um indice
curl -s http://xxxxxxx:yyyy/_cat/indices?bytes=m | \
grep "01.16" | grep webtraffic | awk '{print $9}' | \
awk '{s+=$1} END {print s}'
Mover shards
#!/bin/bash
URL="http://host:9200/_cluster/reroute"
cat <<EOF > /tmp/es_file.json
{
"commands" : [
{
"move" : {
"index" : "${1}", "shard" : ${2},
"from_node" : "${8}", "to_node" : "${9}"
}
}
]
}
EOF
echo "---------"
echo $@
echo -n "curl -H \"Content-Type: application/json\" -XPOST $URL -d"
echo ""
/bin/cat /tmp/es_file.json
echo "CONTINUE?"
read
echo ""
echo "running curl"
date
curl -H "Content-Type: application/json" -XPOST $URL -d @/tmp/es_file.json > /tmp/output/$1_$8_$9.json
date
ls -lahs /tmp/output/$1_$8_$9.json