diff --git a/transformAndIndexRppd.sh b/transformAndIndexRppd.sh index 23d96f6..1271792 100644 --- a/transformAndIndexRppd.sh +++ b/transformAndIndexRppd.sh @@ -9,12 +9,18 @@ cd ../rpb bash transformRppd.sh cd - sbt -Dindex.prod.name=$INDEX "runMain apps.Index baseline" -curl -X POST "weywot3:9200/_aliases?pretty" -H 'Content-Type: application/json' -d' -{ - "actions" : [ - { "remove" : { "index" : "*", "alias" : "'"$ALIAS"'" } }, - { "add" : { "index" : "'"$INDEX"'", "alias" : "'"$ALIAS"'" } } - ] -} -' -curl -S -s -o /dev/null https://rppd.lobid.org + +COUNT=$(curl -X POST "weywot3:9200/$INDEX/_count" | jq .count) +if (( $COUNT > 10000 )) ; then + curl -X POST "weywot3:9200/_aliases?pretty" -H 'Content-Type: application/json' -d' + { + "actions" : [ + { "remove" : { "index" : "*", "alias" : "'"$ALIAS"'" } }, + { "add" : { "index" : "'"$INDEX"'", "alias" : "'"$ALIAS"'" } } + ] + } + ' + curl -S -s -o /dev/null https://rppd.lobid.org +else + echo "Not switching alias, index count for $INDEX is too low: $COUNT" +fi