I had created a bunch of custom modules
bundled in a single package on a SugarCRM 8.0.0 staging instance. In order to migrate these modules
I decided to publish
the package so that I could have an installable zip uploaded to another instance. Unfortunately when I try to upload the zip file on the receiving instance using module loader, the installation hangs at 80 percent gives an error in the sugarlog
I am running ElasticSearch 5.4
which is compatible with the instance of the Sugar I am running. This is the error that is shown in the logs:
Thu Mar 28 17:54:19 2019 [1786][1][FATAL] Elasticsearch request failure: no such index [index: ab164c0013004724c8eba5f5f6f3f646_shared]
Thu Mar 28 17:54:19 2019 [1786][1][FATAL] Exception in Controller: Elastica\Exception\ResponseException: no such index [index: ab164c0013004724c8eba5f5f6f3f646_shared] in /var/www/html/SugarPro-Full-8/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php:179
Stack trace:
#0 /var/www/html/SugarPro-Full-8/vendor/ruflin/elastica/lib/Elastica/Request.php(193): Elastica\Transport\Http->exec(Object(Elastica\Request), Array)
#1 /var/www/html/SugarPro-Full-8/vendor/ruflin/elastica/lib/Elastica/Client.php(674): Elastica\Request->send()
#2 /var/www/html/SugarPro-Full-8/src/Elasticsearch/Adapter/Client.php(355): Elastica\Client->request('ab164c001300472...', 'PUT', Array, Array)
#3 /var/www/html/SugarPro-Full-8/vendor/ruflin/elastica/lib/Elastica/Client.php(706): Sugarcrm\Sugarcrm\Elasticsearch\Adapter\Client->request('ab164c001300472...', 'PUT', Array, Array)
#4 /var/www/html/SugarPro-Full-8/vendor/ruflin/elastica/lib/Elastica/Index.php(562): Elastica\Client->requestEndpoint(Object(Elasticsearch\Endpoints\Indices\Mapping\Put))
#5 /var/www/html/SugarPro-Full-8/vendor/ruflin/elastica/lib/Elastica/Type.php(523): Elastica\Index->requestEndpoint(Object(Elasticsearch\Endpoints\Indices\Mapping\Put))
#6 /var/www/html/SugarPro-Full-8/vendor/ruflin/elastica/lib/Elastica/Type/Mapping.php(250): Elastica\Type->requestEndpoint(Object(Elasticsearch\Endpoints\Indices\Mapping\Put))
#7 /var/www/html/SugarPro-Full-8/src/Elasticsearch/Index/IndexManager.php(486): Elastica\Type\Mapping->send()
#8 /var/www/html/SugarPro-Full-8/src/Elasticsearch/Index/IndexManager.php(390): Sugarcrm\Sugarcrm\Elasticsearch\Index\IndexManager->sendMapping(Object(Elastica\Type\Mapping))
#9 /var/www/html/SugarPro-Full-8/src/Elasticsearch/Index/IndexManager.php(285): Sugarcrm\Sugarcrm\Elasticsearch\Index\IndexManager->createIndices(Object(Sugarcrm\Sugarcrm\Elasticsearch\Index\IndexCollection), Object(Sugarcrm\Sugarcrm\Elasticsearch\Analysis\AnalysisBuilder), Object(Sugarcrm\Sugarcrm\Elasticsearch\Mapping\MappingCollection), false)
#10 /var/www/html/SugarPro-Full-8/src/Elasticsearch/Index/IndexManager.php(200): Sugarcrm\Sugarcrm\Elasticsearch\Index\IndexManager->syncIndices(Array, false)
#11 /var/www/html/SugarPro-Full-8/src/SearchEngine/Engine/Elastic.php(113): Sugarcrm\Sugarcrm\Elasticsearch\Index\IndexManager->addMappings(Array)
#12 /var/www/html/SugarPro-Full-8/ModuleInstall/ModuleInstaller.php(3489): Sugarcrm\Sugarcrm\SearchEngine\Engine\Elastic->addMappings(Array)
#13 /var/www/html/SugarPro-Full-8/ModuleInstall/ModuleInstaller.php(168): ModuleInstaller->setup_elastic_mapping()
#14 /var/www/html/SugarPro-Full-8/modules/Administration/UpgradeWizard_commit.php(342): ModuleInstaller->install('cache/upgrades/...')
#15 /var/www/html/SugarPro-Full-8/include/MVC/View/SugarView.php(489): require_once('/var/www/html/S...')
#16 /var/www/html/SugarPro-Full-8/include/MVC/View/views/view.classic.php(43): SugarView->includeClassicFile('cache/upgrades/...')
#17 /var/www/html/SugarPro-Full-8/include/MVC/View/SugarView.php(152): ViewClassic->display(Array)
#18 /var/www/html/SugarPro-Full-8/include/MVC/Controller/SugarController.php(351): SugarView->process(Array)
#19 /var/www/html/SugarPro-Full-8/include/MVC/Controller/SugarController.php(299): SugarController->processView()
#20 /var/www/html/SugarPro-Full-8/include/MVC/SugarApplication.php(198): SugarController->execute()
#21 /var/www/html/SugarPro-Full-8/index.php(27): SugarApplication->execute()
#22 {main}
Thu Mar 28 17:54:19 2019 [1786][1][FATAL] ERROR: rmdir_recursive(): argument cache/upgrades/temp/ICB8l3 is not a file or a dir.
I have tried to repair and rebuild several times, and have also tried to publish the package again to recheck if there were any errors I may have not noticed. I tried to use another instance for uploading in case my current instance may be corrupt, but the same was observed. I do not understand what may be causing the issue.
Elasticsearch request failure: no such index [index: ...]
This suggests that the Elasticsearch Index is missing (or corrupted).
How to fix:
Notes:
The name of the Elasticsearch index is based on the value of $sugar_config['unique_key']
in config.php
. Changing this value and rebuilding the cache will result in Sugar looking for a new index name. You'll have to trigger a reindex as described above (unless you somehow rename the index in Elasticsearch, so that it will be found again).
The newly created index will possibly remain empty (which should be enough for module installs though) unless your cron/Schedulers are running. If the Elastic Search Scheduler is running it will fill the index with data within the next minutes/hours and you can use the search on the top right of Sugar.
If you have access to the server's host-system, you can also choose to re-create the Index from the command-line:
bin/sugarcrm search:silent_reindex --clearData
(slow, only runs on single cpu core) or
bin/sugarcrm search:silent_reindex_mp --clearData
(fast, can use several cpu cores)
The file bin/sugarcrm
must have executable permissions for this.
(The first and single-threaded way may also work by prefixing php
instead)
The last - or possibly both - commands may not be available if your Sugar version is very outdated.