I am using Centos and I start the elasticsearch as as service from root user .
despite these settings I am still getting the warning of max number of threads too low.
I have put the following lines in the /etc/security/limits.conf
elasticsearch - nofile 65536
root - nofile 65536
and in /etc/sysconfig/elasticsearch I have put the following
MAX_OPEN_FILES=65536
and in /usr/lib/system/system/elasticsearch.service
[root@hadoop1 ~]# grep LimitNOFILE /usr/lib/systemd/system/elasticsearch.service
LimitNOFILE=65536