diff --git a/contrib/packager.io/functions b/contrib/packager.io/functions index 6fcd81b40..92fdcd786 100644 --- a/contrib/packager.io/functions +++ b/contrib/packager.io/functions @@ -234,17 +234,11 @@ 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 ${ES_INDEX} elasticsearch index..." - curl -XDELETE "${ES_CONNECTION}/${ES_INDEX}" + echo "# Deleting old elasticsearch index..." + zammad run rake searchindex:drop yes | /usr/share/elasticsearch/bin/elasticsearch-plugin -s remove mapper-attachments @@ -254,7 +248,7 @@ function setup_elasticsearch () { yes | /usr/share/elasticsearch/bin/elasticsearch-plugin -s install ingest-attachment - if [ "{ES_CONNECTION}" == "http://127.0.0.1:9200" ]; then + if [ "${ES_CONNECTION}" == "http://127.0.0.1:9200" ]; then ${INIT_CMD} restart elasticsearch else echo -e "\n It seems you're running an external Elasticsearch server on ${ES_CONNECTION}" @@ -277,7 +271,6 @@ function elasticsearch_searchindex_rebuild () { } function update_or_install () { - setup_elasticsearch if [ -f ${ZAMMAD_DIR}/config/database.yml ]; then update_database @@ -300,6 +293,8 @@ function update_or_install () { initialise_database fi + setup_elasticsearch + elasticsearch_searchindex_rebuild }