How to reduce Elasticsearch CPU usage?

I’m using Seafile Pro 9.0.5 on a small VM, and Elasticsearch consumes a lot of CPU, all the time.

Is there any way to reduce the CPU impact, while still indexing Office and PDF files? If it matters, I’m running Seafile with Docker Compose.

My seafevents.conf file looks like:

    [INDEX FILES]
enabled = true
interval = 10m

highlight = fvh

## If true, indexes the contents of office/pdf files while updating search index
## Note: If you change this option from "false" to "true", then you need to clear the search index and update the index again. See the FAQ for details.
index_office_pdf = true

external_es_server = true
es_host = elasticsearch
es_port = 9200

[OFFICE CONVERTER]
port = 6000
host = 127.0.0.1
enabled = true
workers = 1

## how many pages are allowed to be previewed online. Default is 50 pages
max-pages = 50

## the max size of documents allowed to be previewed online, in MB. Default is 10 MB
## Previewing a large file (for example >30M) online is likely going to freeze the browser.
max-size = 10

I suggest you try to increase the memory for Elasticsearch. It is possible you have a small amount of memory and the Java process is always in GC.

Elasticsearch is being given 768MB of RAM, which I would have thought was plenty? A while back I recall running test instances with only 256MB without issue.

I noticed Elasticsearch is configured to write a GC log, which I can see inside the Docker container - is there anything in particular I should look for in that log to confirm/deny that GC is a problem?