Giter Club home page Giter Club logo

elasticsearch's Introduction

Author

Remigijus Kiminas, Live Helper Chat

ElasticSearch versions support

  • For ElasticSearch 7 use master branch
  • For ElasticSearch 5-6 use master-5.x-6.x branch

Description

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

See image

How it works?

  • After chat close event chat is indexed within cronjob.
  • Also there is cronjob which indexes existing data.

Future plans

  • Remove older chat's than 3 months and implement fallback if record is not found in MySQL. At the moment we just duplicate records.

Install

  1. Put elasticsearch folder in extensions folder.
  2. copy extension/elasticsearch/settings.ini.default.php to extension/elasticsearch/settings.ini.php and edit settings
  3. Activate extension in main settings lhc_web/settings/settings.ini.php file
'extensions' => 
      array (
        'elasticsearch'
      ),
  1. Install dependencies composer install from extension folder
  2. Go to back office and clear cache.
  3. Go to Modules -> Elastic Search
  4. Click create index and later update structure
  5. Execute doc/install.sql

Indexing existing chats

php cron.php -s site_admin -e elasticsearch -c cron/index_chats

Indexing existing messages

php cron.php -s site_admin -e elasticsearch -c cron/index_msg

Indexing existing online sessions

php cron.php -s site_admin -e elasticsearch -c cron/index_os

Setup automatic indexing [Required]

*/5 * * * * cd /home/www/lhc && php cron.php -s site_admin -e elasticsearch -c cron/cron > log_index.txt /dev/null 2>&1

Used to generate online operators/Active/Pending chat's chart [Optional]

* * * * * cd /home/www/lhc && php cron.php -s site_admin -e elasticsearch -c cron/cron_1m > cron_1m.txt /dev/null 2>&1

Used to remove duplicates every week [Optional]

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

Reindex recent chats [Optional]

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

Using daily/monthly index

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

Monitoring Elasticsearch

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

elasticsearch's People

Contributors

remdex avatar allwarezz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.