Elasticsearch taking all the memory of the system

This is not accurate. The filesystem cache and memory mapped files will be freed if the system needs more physical memory. Therefore, the system should not be inaccessible.

Additionally, for server applications like Elasticsearch the presumption is that the application will have full access to system resources and that if the system operator wants something different, they will setup restrictions doing so (e.g., putting the application in a cgroup that limits resource usage).

This is not expected. What information can you provide regarding this (e.g., logs)?