Elastic Search

How Do I Log into Elasticsearch?

Elasticsearch is a well-growing and robust solution to analyze and store several types of data, usually nonstructural and semi-structural data. It stores the data in the form of documents and indices rather than tables, which is definitely different from traditional or SQL databases. It preserves the data in JSON format and extracts and analyzes it using rest APIs.

This post will demonstrate how to log in to Elasticsearch.

Prerequisite: How to Install and Setup Elasticsearch?

The Installation setup for the different platforms such as Windows, Mac OS, Docker, and Linux are available on its official website. To get Elasticsearch on the Windows system, it is recommended to use the zip setup of Elasticsearch to get the latest version from the official website.

In order to install and set up Elasticsearch on Windows, follow our associated post that will guide you through a step-by-step procedure to install Elasticsearch.

How to Log In to Elasticsearch?

When Elasticsearch is installed on the system and the Elasticsearch engine is started for the first time, it generates the essential credentials username and password and token to configure Kibana with Elasticsearch. The generated credentials can be used to access Elasticsearch.

Follow the listed instructions to log into Elasticsearch.

Step 1: Run Elasticsearch Engine

To execute the Elasticsearch on the system, navigate to its Elasticsearch setup directory and open the “bin” directory with the help of the “cd” command:

cd C:\Users\Dell\Documents\Elk stack\elasticsearch-8.7.0\bin

Next, run the Elasticsearch batch file using the given command and start the Elasticsearch database:

elasticsearch.bat

When the cluster health changes to “YELLOW” or “GREEN”, users can log in to Elasticsearch:

Step 2: Log In to Elasticsearch

Now, navigate to the URL “localhost:9200” to access Elasticsearch. This will pop out the “Sign In” box. Provide the username and password that was generated while starting the Elasticsearch engine for the first time. After that, press the “Sign In” button:

Here, you can see we have logged in to Elasticsearch successfully:

In case, if a user misplaces the login credentials or forgets the Elasticsearch password, then, they can reset the password by following the below section.

How to Reset the Password in Elasticsearch?

To reset the password in Elasticsearch, again navigate to the “bin” folder of Elasticsearch and utilize the “elasticsearch-reset-password” command. Also, specify the user name using the “-u” option:

elasticsearch-reset-password -u elastic

How to Log In to Elasticsearch From the Command Line?

In order to access Elasticsearch indexes from the command line, utilize the “curl” command along with Elasticsearch default address “localhost:9200”. The “-u” flag is utilized to specify the user’s credentials along with the command to access Elasticsearch from CLI:

curl localhost:9200 -u elastic:<user-password>

We have covered how to log in to Elasticsearch.

Conclusion

To log in to Elasticsearch, first, install it on the system and save the login credentials that were generated while executing the Elasticsearch for the first time. After that, start the Elasticsearch engine and navigate to the “localhost:9200” URL. Provide the username “elastic” user and password and hit the “Sign In” button. If you have misplaced the user password, you can reset it using the “elasticsearch-reset-password -u <user-name>” command. This post has illustrated how to log in to Elasticsearch.

About the author

Rafia Zafar

I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.