How to set memory limit for ElasticSearch in Windows

Running elasticsearch on my local development machine takes up half of system memory by default. Here is instructions on how to change max memory size.

* Windows 10
* This instruction is for Elasticsearch version 7.16.2 but probably works on other versions as well
* Running elasticsearch.bat (in development mode not as a service)

Goto folder:
Create file:
“jvm.options” (normal text file, utf-8)
Setting for maximum of 4GB memory allocation:


Change both “4” values into other value if desired.
Restart elasticservice.bat

Instructions if running elasticsearch as a service on Windows:

You can set the memory limit for Elastic Search on Windows Server by following command:

[Elasticsearch Path]\bin>elasticsearch-service.bat manager

Note: Run command prompt as administrator

It will open manager as shown here: Image: ElasticSearch service properties

Now go to the ‘Java’ tab and change settings based on your requirement.

Note: Make sure, you changed it under ‘JavaOptions’ textbox and also for separate parameters. For example, to set 1GB initial memory pool and maximum memory pool, you can set ‘1024’ MB for both.