How to solve elasticsearch not working

Sometimes it might be necessary to reset LiveAgent's integration with elasticsearch and start again from scratch.

In such case, you would first disable the elasticsearch in LiveAgent in section Configuration > System > Elasticsearch

then you should manually delete the existing indices previously created by LiveAgent.
First list the existing indices using the following curl command

> curl https://localhost:9200/_cat/indices
yellow open la_search_contacts_v1.10     qUCXkH74R3egFxYrKCZauQ 50 2 4 1 40.6kb 40.6kb
yellow open la_search_knowledgebase_v1.7 54vRHHOJSfSJDfW4t26lZw 50 2 0 0 10.9kb 10.9kb
yellow open la_search_tickets_v1.11      zMwGJz36TCaPKyybOWXMaw 70 2 0 0 15.3kb 15.3kb

then delete the indices with names like la_search_* using the following command (use once for each index name obtained from the above result)

> curl -X DELETE https://localhost:9200/la_search_contacts_v1.10

LiveAgent also creates aliases for the indices, using this command you can list the aliases.
Before deleting the indices, the output would look like the following example, after deleting the indices, there should be no aliases.

> curl https://localhost:9200/_cat/aliases   
la_search_contacts      la_search_contacts_v1.10       * - - -
la_search_knowledgebase la_search_knowledgebase_v1.7   * - - -
la_search_tickets       la_search_tickets_v1.11        * - - -

After the indices have been deleted, return back to LiveAgent configuration, and enable the elasticsearch integration.

As the last step, you will need to manually start indexing of tickets, knowledge base articles and contacts.
To start this process, click re-index button next to each of the 3 sections for tickets, knowledge base and contacts.

Indexing runs in the background using queue job mechanism, on your standalone installation this is handled by queue.php script, executed periodically by cron. Email sending also relies on the queue jobs mechanism, therefore during indexing, emails might be delayed. Please keep this in mind and select the suitable time frame for indexing accordingly.