reindex.sh: fix variable names

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-05-28 23:06:36 +02:00
parent 7baff3493d
commit 3c142fffd8
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 20 additions and 7 deletions

View File

@ -4,12 +4,12 @@ set -e
#set -x
function queryAPI() {
method=$1
path=$2
data=$3
cmd="curl -f -s -X${method} http://localhost:9200/${path}"
if [[ -n "${data}" ]]; then
cmd+=" -H 'content-type:application/json' -d '${data}'"
local method=$1
local url_path=$2
local payload=$3
cmd="curl -f -s -X${method} http://localhost:9200/${url_path}"
if [[ -n "${payload}" ]]; then
cmd+=" -H 'content-type:application/json' -d '${payload}'"
fi
eval "${cmd}"
}
@ -58,24 +58,37 @@ fi
old="${index}"
new="${index}-re"
echo "*----------- ${old} ------------------------------"
echo "? $(printf '%-21s' ${old}) - Count: $(docs_count ${old})"
echo "? $(printf '%-21s' ${old}) - Size: $(size_in_bytes ${old}) MB"
echo "+ Creating: ${new}"
create "${new}" > /dev/null
echo "+ Reindexing: ${old} -> ${new}"
reindex "${old}" "${new}" > /dev/null
echo "? $(printf '%-21s' ${new}) - Count: $(docs_count ${new})"
echo "? $(printf '%-21s' ${new}) - Size: $(size_in_bytes ${new}) MB"
echo "! Deleting: ${old}"
delete "${old}" > /dev/null
echo "+ Cloning: ${new} -> ${old}"
read_only "${new}" > /dev/null
clone "${new}" "${old}"
clone "${new}" "${old}" > /dev/null
echo "+ Waiting: ${old}"
wait_green "${old}" > /dev/null
echo "? $(printf '%-21s' ${old}) - Count: $(docs_count ${old})"
echo "? $(printf '%-21s' ${old}) - Size: $(size_in_bytes ${old}) MB"
echo "! Deleting: ${new}"
delete "${new}" > /dev/null
echo "*----------- ${old} ------------------------------"