How to change directory for path.data and path.logs in elasticsearch in cent Operating system 7.7?

How to change directory for path.data and path.logs in elasticsearch in cent Operating system 7.7?

I tried to change the path manually in yml file. But every time error is popping out and its failing due to configuration issue.

Error is stating : ERROR Unable to create file /home/user/new_path/logs/file.log java.io.IOException: Could not create directory /home/user/new_path/logs/

Does the directory /home/user/new_path/ exist?

Maybe the permissions are not correct.

I opened elasticsearch.yml file, then changed path.log to /home/user_name/new_path_to_logs and path.data to /home/user_user/new_path_to_data. And then when I tried sudo systemctl start Elasticsearch. Error which I got is stating : ERROR Unable to create file /home/user/new_path/logs/file.log java.io.IOException: Could not create directory /home/user/new_path/logs/

Did you try to execute sudo systemctl reload Elasticsearch before restarting it?

I used : systemctl daemon-reload elasticsearch before and after every modification done on yml file.
Still it didn't work.