Skip to content

Basic Installation

Josua Hunziker edited this page Mar 1, 2019 · 18 revisions

Installation of FullTextSearch with ElasticSearch and a Files Indexer

Installation of Nextcloud App

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

Configuration

The configuration regarding all app you just installed can be done from the Admin Settings page, in the Full text search tab:

First index

Run the command:

sudo -u www-data php ./occ fulltextsearch:index

A complete list of the commands

If you have a lot of files, it's a good idea to run this in a screen or 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 occ):

[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 /usr/lib/tmpfiles.d/samba.conf:

d /var/run/samba 2775 root www-data - -
You can’t perform that action at this time.