Fulltextsearch crashed whiled indexing: Allowed memory size of 536870912 bytes exhausted

App crashes while indexing a (propably) not well formatted document, like PDF or EPUB.

Nextcloud 29.0.2
Full text search 29.0.0
Elasticsearch 8
Ubuntu 22.0.4 LTS
PHP 8.2
32 GB RAM
8 GB JVM Heap

occ fulltextsearch:index

PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 251658272 bytes) in /var/www/clients/client1/web8/web/apps/fulltextsearch_elasticsearch/lib/Vendor/Elastic/Transport/Transport.php on line 201

App also crashes when PHP memory_limit = 1024M instead of 512M.