Installation of FullTextSearch with ElasticSearch and a Files Indexer
Installation of Nextcloud App
- Installation of FullTextSearch : you can install the app directly from the appstore, or manually with the source from github.
- Installation of FullTextSearch_ElasticSearch
- Installation of Files_FullTextSearch
Installation of ElasticSearch + "Ingest Attachment Plugin" on your server
First visit the ElasticSearch documentation:
After you installed ElasticSearch as described, you have to install the requirements: https://www.elastic.co/guide/en/elasticsearch/plugins/current/ingest-attachment.html
Running the elasticsearch docker container
In order to run elasticsearch from the docker container, you need to install the ingest attachment plugin. Therefore you can use the following Dockerfile:
FROM elasticsearch RUN bin/elasticsearch-plugin install --batch ingest-attachment
The configuration regarding all app you just installed can be done from the Admin Settings page, in the Full text search tab:
Run the command:
sudo -u www-data php ./occ fulltextsearch:index
If you have a lot of files, it's a good idea to run this in a
tmux session, so the index will continue if you disconnect. It will not continue in the background on its own.
Live index service
(will work with NC 14 and later)
To have your files continuously indexed, you'll need to run
fulltextsearch:live. This can be easily achieved on systems running systemd with an unit
/etc/systemd/system/nextcloud-fulltext-elasticsearch-worker.service file like this (make sure to adjust
WorkingDirectory and path to
[Unit] Description=Elasticsearch Worker for Nextcloud Fulltext Search After=network.target [Service] User=www-data Group=www-data WorkingDirectory=/var/www/nextcloud ExecStart=/usr/bin/php /var/www/nextcloud/occ fulltextsearch:live -q ExecStop=/usr/bin/php /var/www/nextcloud/occ fulltextsearch:stop Nice=19 Restart=always [Install] WantedBy=multi-user.target
Note: If you have errors after a system reboot, maybe you have to add your database server to the After and Requires statements.
Note: For mysql or mariadb it looks like:
[Unit] Description=Elasticsearch Worker for Nextcloud Fulltext Search After=network.target mysql.service Requires=mysql.service ...
Enable and start:
systemctl enable nextcloud-fulltext-elasticsearch-worker.service systemctl start nextcloud-fulltext-elasticsearch-worker.service
Note: If you want to index external SMB shares, add this to
d /var/run/samba 2775 root www-data - -