Add password to elasticsearch

Let’s say the elasticsearch is installed at following path elasticsearch C:\elasticsearch-7.17.0\config.

Navigate to the elasticsearch.yml config file and set xpack.security.enabled to true.

Navigate to bin folder of elasticsearch installation and run the following command in the terminal bin/elasticsearch-setup-passwords interactive

Follow the steps mentioned in the prompt.

Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.<br>You will be prompted to enter passwords as the process progresses.<br>Please confirm that you would like to continue [y/N]y

Enter the password for the elasticsearch user. Enter the passwords for all the prompts.

Accessing the elasticsearch endpoint will prompt for username/password now.