How to implement Elasticsearch in Nexcloud

Does anyone have any information on how to implement and get the elasticsearch feature for indexing and full text search in Nethserver Nextcloud any help would be greatly appreciated.

Thank you,

Steve

I used elasticsearch here, there is a working documentation:

https://docs.zammad.org/en/latest/install-elasticsearch.html#centos-7

Edit /etc/elasticsearch/elasticsearch.yml and add network host 127.0.0.1:

#network.host: 192.168.0.1
network.host: 127.0.0.1

Restart elasticsearch: systemctl restart elasticsearch

Test if elasticsearch is running: curl -X GET localhost:9200

Now go to nextcloud and “Install and enable” following apps:

  • Full text search
  • Full text search - Files
  • Full text search - Elasticsearch

In “Settings”, “Full text search” set the following:

  • Full text search -> Search Platform to Elasticsearch
  • Elastic Search -> Address of the Servlet to http://localhost:9200
  • Elastic Search -> Index to nextcloud

Index the files:

sudo -u apache /opt/rh/rh-php71/root/usr/bin/php /usr/share/nextcloud/occ fulltextsearch:index

Sources:


https://timscha.io/elasticsearch-in-nextcloud-13-einbinden/ (German)

3 Likes

Getting a complaint on this that the memory limit is set lower than the recommended 512MB, and in fact the process crashes when it runs out of memory:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 26039464 bytes) in /usr/share/nextcloud/apps/fulltextsearch_elasticsearch/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php on line 573

So, following this post:


I re-ran the command adding the flag of -d memory_limit=512M. But at that point, I get this:
image
Is it still running in the background, and I should just wait for it to finish? Or do I need to do something to kill the search process that was started, so I can restart it?

I tested it with a fresh nextcloud installation so indexing just took a few seconds.

I tested this with admin user and it worked…

Maybe you have to stop or reset the indexing:

occ fulltextsearch:stop
occ fulltextsearch:reset

I tried it again (a couple of hours later) and it’s running now. So either it completed the index in the background, or the process just took a while to die.

This worked great thank you guys for all the help I have another issue logged in as admin Nextcloud with the external storage enabled I cant add I get a screen that says “No external storage configured or you don’t have the permission to configure them” Anybody experienced this or know how to fix.

I tried to setup an SMB share now and it worked, are you logged in as Nextcloud admin and clicking on “External Storage” under “Administration”?

Yes I’m logged in as admin and below is a screenshot that I receive when I click on external storage

You clicked on “External Storage” under “Personal” but you may have to click on it under “Administration”:

Did you configure some external storage from the other “External Storages” link menu towards the bottom of the screen?

1 Like

Ok I see my bad sorry clicking on the thing thanks again is their any information anywhere that shows the proper configuration using a samba share thats set up on Nethserver?

Should be straightforward:

Tesseract OCR would seem like a nice thing to have as well–any ideas on adding that?

I have Elasticsearch working in Nextcloud appears to be finding results however the results are not listed in the view panel has shown here.

Does it work with local files ticked? Did you try another browser?

I uploaded some local files into a test folder I created in nextcloud and reindexed and it worked however it will lot work when i add ext SFT Storage share

Did you enable external files in the Nextcloud Full text search settings?

I don’t have an SFT share to test but it’s working with an SMB share.

got it working using smb share…I’m getting PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 26039464 bytes) in /usr/share/nextcloud/apps/fulltextsearch_elasticsearch/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php on line 573

does the command: sudo -u apache /opt/rh/rh-php71/root/usr/bin/php -d memory_limit=512M /usr/share/nextcloud/occ files:scan -v username" actually index the files or just scan them?

It just scans the files.

For indexing:

sudo -u apache /opt/rh/rh-php71/root/usr/bin/php -d memory_limit=512M /usr/share/nextcloud/occ fulltextsearch:index

Interested too in this…