Fixing elasticsearch “max number of threads for user is too low” with systemd

If you’re installed elasticsearch from repos and running it via systemd, you may see, that it will not catch up limits from /etc/security/limits.conf , so you can easily override it using systemd:

Create folder /etc/systemd/system/elasticsearch.service.d/

Then create file override.conf in that folder with following contents:

[Service]
LimitNPROC=2048

Reload daemons: systemctl daemon-reload

Restart elastic: systemctl restart elasticsearch

Now changes will remain even if you’ll update elastic via package manager (which will recreate service file).