Create ES indexes via setup wizard
commit
Author: Jagrut Sharma
Date:   Tue Aug 22 13:07:04 2017 -0700
updated install es script
@@ -82,3 +82,50 @@ echo "Starting Elasticsearch"
sudo service elasticsearch start
echo "Elasticsearch install complete"
+
+SERVICE='elasticsearch'
+
+function check_service {
+ if service $SERVICE status | grep running > /dev/null
+ then
+ #echo "$SERVICE is running"
+ retval=0
+ else
+ #echo "$SERVICE is NOT running"
+ retval=1
+ fi
+}
+
+retval=1
+numtries=1
+maxtries=10
+
+echo "Waiting for $SERVICE service to start ..."
+while [ "$retval" != 0 ]
+do
+ echo "."
+ sleep 1s
+ check_service
+ ((numtries++))
+
+ if [ "$numtries" -gt "$maxtries" ]
+ then
+ echo "Timeout reached"
+ break
+ fi
+done
+
+if [ "$retval" == 0 ]
+then
+ echo "Waiting for 10 seconds for the engine to start up, and then will create Kylo indexes in Elasticsearch."
+ echo "NOTE: If they already exist, an index_already_exists_exception will be reported. This is OK."
+ sleep 10s
+ $SETUP_FOLDER/../bin/create-kylo-indexes-esv5.sh localhost 9200 1 1
+else
+ echo "$SERVICE service did not start within a reasonable time. Please check and start it. Then, execute this script manually before starting Kylo."
+ echo "This script will create Kylo indexes in Elasticsearch."
+ echo "NOTE: If they already exist, an index_already_exists_exception will be reported. This is OK."
+ echo "$SETUP_FOLDER/../bin/create-kylo-indexes-esv5.sh localhost 9200 1 1"
+fi
+
+echo "Elasticsearch index creation complete"
\ No newline at end of file
