By default, Elasticsearch does not enable user authentication mechanisms.
Starting from version 5.x, Elastic Stack introduced the X-Pack plugin. In version 7.x, basic security features for Elasticsearch and Kibana are enabled by default in the basic edition, including password protection.
When you first install Elasticsearch, you need to initialize the passwords for built-in users.
Elasticsearch has several built-in users, such as elastic, kibana, and logstash_system. Among them, the elastic user is a superuser that can be used to log in to Kibana and manage the Elasticsearch cluster.
In versions of Elasticsearch with basic security enabled, there are no default passwords. Instead, you need to use the elasticsearch-setup-passwords command during setup to set passwords for built-in users. For example, the following command can set passwords for all built-in users:
bashbin/elasticsearch-setup-passwords auto
This command generates random passwords for each built-in user and displays them in the command line. Alternatively, you can use the interactive command interactive to set passwords for each user as desired.
For Docker container instances of an Elasticsearch cluster, you can specify the password for the elastic user by setting the environment variable ELASTIC_PASSWORD.
Please note that for security reasons, you should avoid using default or weak passwords and set strong passwords for all built-in users during deployment. Additionally, for production environments, it is recommended to configure user roles following the principle of least privilege to reduce security risks.