Skip to content

Commit 4c72bd9

Browse files
committed
Merge branch 'rppd_rpb-189-aliasSwitch' of https://github.com/hbz/lobid-gnd into rppd
Resolves https://jira.hbz-nrw.de/browse/RPB-189
2 parents 2456313 + 9b99804 commit 4c72bd9

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

transformAndIndexRppd.sh

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ cd ../rpb
99
bash transformRppd.sh
1010
cd -
1111
sbt -Dindex.prod.name=$INDEX "runMain apps.Index baseline"
12-
curl -X POST "weywot3:9200/_aliases?pretty" -H 'Content-Type: application/json' -d'
13-
{
14-
"actions" : [
15-
{ "remove" : { "index" : "*", "alias" : "'"$ALIAS"'" } },
16-
{ "add" : { "index" : "'"$INDEX"'", "alias" : "'"$ALIAS"'" } }
17-
]
18-
}
19-
'
20-
curl -S -s -o /dev/null https://rppd.lobid.org
12+
13+
COUNT=$(curl -X POST "weywot3:9200/$INDEX/_count" | jq .count)
14+
if (( $COUNT > 10000 )) ; then
15+
curl -X POST "weywot3:9200/_aliases?pretty" -H 'Content-Type: application/json' -d'
16+
{
17+
"actions" : [
18+
{ "remove" : { "index" : "*", "alias" : "'"$ALIAS"'" } },
19+
{ "add" : { "index" : "'"$INDEX"'", "alias" : "'"$ALIAS"'" } }
20+
]
21+
}
22+
'
23+
curl -S -s -o /dev/null https://rppd.lobid.org
24+
else
25+
echo "Not switching alias, index count for $INDEX is too low: $COUNT"
26+
fi

0 commit comments

Comments
 (0)