Remigijus Kiminas, Live Helper Chat
- For ElasticSearch 7 use master branch
- For ElasticSearch 5-6 use master-5.x-6.x branch
This plugin enables statistic generation using only Elastic Search. MySQL is not a good solution for statistic generation, but Elastic Search does great job on that.
- Eliminates MySQL Queries in statistic generation
- Allows to search withing messages with keyword
- Allows to generate Online Operators/Active/Pending chat's chart
- After chat close event chat is indexed within cronjob.
- Also there is cronjob which indexes existing data.
- Remove older chat's than 3 months and implement fallback if record is not found in MySQL. At the moment we just duplicate records.
- Put elasticsearch folder in extensions folder.
- copy
extension/elasticsearch/settings.ini.default.php
toextension/elasticsearch/settings.ini.php
and edit settings - Activate extension in main settings
lhc_web/settings/settings.ini.php
file
'extensions' =>
array (
'elasticsearch'
),
- Install dependencies
composer install
from extension folder - Go to back office and clear cache.
- Go to Modules -> Elastic Search
- Click create index and later update structure
- Execute doc/install.sql
php cron.php -s site_admin -e elasticsearch -c cron/index_chats
php cron.php -s site_admin -e elasticsearch -c cron/index_msg
php cron.php -s site_admin -e elasticsearch -c cron/index_os
*/5 * * * * cd /home/www/lhc && php cron.php -s site_admin -e elasticsearch -c cron/cron > log_index.txt /dev/null 2>&1
* * * * * cd /home/www/lhc && php cron.php -s site_admin -e elasticsearch -c cron/cron_1m > cron_1m.txt /dev/null 2>&1
Duplicates can happen because elastic does not quarantine transactions. So this will make sure that there are no duplicates in ElasticSearch.
22 8 4 * * cd /home/www/lhc && php cron.php -s site_admin -e elasticsearch -c cron/remove_duplicates > log_duplicates.txt /dev/null 2>&1
Sometimes elastic search might miss chat's in it's index especially if it just hangs or some other bad things happens. This reindex last 16 hours chats to be sure they are presented in ElasticSearch.
36 */8 * * * cd /home/www/lhc && php cron.php -s site_admin -e elasticsearch -c cron/reindex_recent > log_reindex_recent.txt /dev/null 2>&1
I recommend if you are planning to have thousands of chats per day to use monthly index.
If you are running daily/monthly index you should be running this cronjob daily.
5 12 * * * cd /home/www/lhc && php cron.php -s site_admin -e elasticsearch -c cron/index_precreate
To receive notification about failure of Elasticsearch you can run this cronjob. It will automatically turn on/off Elasticsearch extension.
* * * * * cd /home/www/lhc && php cron.php -s site_admin -e elasticsearch -c cron/check_health