Elasticsearch Connector


TRAX LRS provides an Elasticsearch connector which can be used to push the LRS statements to an Elasticsearch database. This feature is accessible only from command line.


The default settings of the Elasticsearch connector can be changed in the .env file.


The Elasticsearch server(s).


Username & Password

The credentials to access the Elasticsearch server(s).



The Elasticsearch index where the statements must be stored.


Batch Size

The number of statements pushed in the same request. Usually, 100 is a good setting. Lower values may result in a slower process. Higher values may result in memory issues.



Before using these commands, you must create a store in your LRS.

Push statements

php artisan statements:elastic-push

The following parameters are optional. When not provided in the command line, some of them will be asked.

Option Example of value Description
--hosts "['localhost:9200']" The Elasticsearch server(s)
--username "elastic-username" The Elasticsearch username
--password "123456" The Elasticsearch password
--index "statements" The Elasticsearch index
--batch 50 The batch size
--owner 1 Internal ID of the LRS store
--noprompt Don't ask options (take defaults)
--restart Restart from the 1st statement

For example, the following command line could be used on a regular basis by a CRON job to sync the LRS with an Elasticsearch database:

php artisan statements:elastic-push --owner=1 --noprompt

Display the status of the last push

php artisan statements:elastic-push-status

When not provided in the command line, the following option will be asked.

Option Example of value Description
--owner 1 Internal ID of the LRS store


When a push request fails or when the process is interrupted, you can resume it where it stopped. Relaunch the command and it will ask you if you want to resume or restart.

When the --noprompt option is used, it always tries to resume, except when the --restart option is used together.