Elasticsearch + Nextcloud
Configuring Nextcloud Full Text Search with Elasticsearch.
Installing Elasticsearch (elastic-7.x)
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt update
sudo apt install elasticsearch
Plugin
Enable inedxing PDF, Office documents, etc.
sudo bin/elasticsearch-plugin install ingest-attachment
Enable Japanese indexing
https://qiita.com/shin_hayata/items/41c07923dbf58f13eec4
sudo bin/elasticsearch-plugin install analysis-kuromoji
Check if tokenizer is working
sudo -u www-data php ./occ fulltextsearch:check
Indexing – for the first time
sudo -u www-data php ./occ fulltextsearch:index
Indexing – automatically on the background
https://github.com/nextcloud/fulltextsearch/wiki/Basic-Installation#live-index-service
Add a service process to run background process.
# /etc/systemd/system/nextcloud-fulltext-elasticsearch-worker.service
[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
Enable the service
systemctl enable nextcloud-fulltext-elasticsearch-worker.service
systemctl start nextcloud-fulltext-elasticsearch-worker.service