get elasticsearch index from settings too

This commit is contained in:
André Bauer 2018-07-31 12:01:02 +02:00
parent 4a610346cc
commit 59b8ccde1f

View file

@ -234,11 +234,17 @@ function setup_elasticsearch () {
ES_CONNECTION="http://127.0.0.1:9200"
fi
ES_INDEX="$(zammad run rails r "puts Setting.get('es_index')" 2>> /dev/null)"
if [ -z "${ES_INDEX}" ]; then
ES_INDEX="zammad_production"
fi
if [ -n "$(/usr/share/elasticsearch/bin/elasticsearch-plugin list | grep mapper-attachments)" ]; then
REBUILD_ES_SEARCHINDEX="yes"
echo "# Deleting old zammad_production elasticsearch index..."
curl -XDELETE "${ES_CONNECTION}/zammad_production"
echo "# Deleting old ${ES_INDEX} elasticsearch index..."
curl -XDELETE "${ES_CONNECTION}/${ES_INDEX}"
yes | /usr/share/elasticsearch/bin/elasticsearch-plugin -s remove mapper-attachments