Do not use the '-' flag to su since it create a login shell. Doing that

will prevent the environment from beeing inherited unless you also use '-m'.

But using '-' and '-m' when running bash will cause the launched shell to
try to read $HOME/.bash_profile since $HOME still refers to the home
directory of root and teh elasticsearch user does not have read access there.

A simple solution is to omit '-' and '-m'. The program will still run under
the elasticsearch user but will inherit environment variables and not
print an error message.