Search.max_buckets and JVM memory pressure

I'm using Elastic 7.1.0 cluster on Elastic Cloud with 2 zones and GCP.DATA.HIGHIO.1 with 16 GB RAM.
I set the search.max_buckets at 1000000 and after an aggregation with search.max_buckets overflow error, I noticed ad increase of the JVM memory pressure, from 50% (more or less) to 75%.
Then I increased the search.max_buckets to 2500000, now I don't have the earch.max_buckets overflow error anymore and the JVM memory pressure remain stable about 50% during the query.
Can someone explain to me this behavior? I don't understand why the JVM memory pressure remain stable.
Another question, is it safe to increase the search.max_buckets so much?
thanks for any kind of help.

2 Likes