Default fulltextsearch setup crashes Elasticsearch on large text files

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 35.0.1
  • Operating system and version (e.g., Ubuntu 24.04):
    • Docker on TrueNAS
  • When did this problem seem to first start?
    • On Install
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • AIO v14.2.0

Description

AIO starts Elasticsearch with -Xms512M -Xmx512M and configures files_fulltextsearch in the Nextcloud entrypoint:

occ files_fulltextsearch:configure '{"files_pdf":true,"files_office":true}'

It leaves files_size at the app default of 20 MB. A user with a few 20 MB plain-text files crashes Elasticsearch during indexing:

java.lang.OutOfMemoryError: Java heap space
Terminating due to java.lang.OutOfMemoryError: Java heap space

The container restarts, fulltextsearch:index exits, and the affected rows in oc_fulltextsearch_index stay at status 28 with "unknown error" / ClientResponseException.

Raising FULLTEXTSEARCH_JAVA_OPTIONS to 1 GB and setting files_size to 5 fixed it, but the defaults should work together. Either of these would do:

  • add "files_size":5 (or similar) to the files_fulltextsearch:configure call, or
  • raise the default heap to something that survives a 20 MB document.

EDIT:

I also do not see anything in the UI or anywhere that the indexing crashed, so without me manually checking progress once in a while I probably wouldn’t have caught it