Follow this basic guide to get you started with Elastic Search for beginners – and – Kibana – the tool that you’ll get asked in job interviews. If you are wondering whu you need it for your personal projects – read my previous post: https://programtom.com/dev/2024/07/03/what-problems-elastic-search-resolves/
1. Introduction to Elasticsearch
Elasticsearch is a distributed, RESTful search and analytics engine capable of solving a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data so you can discover the expected and uncover the unexpected.
2. Prerequisites
- Basic understanding of JSON, HTTP, and RESTful APIs
- Install Java on your machine (Elasticsearch is built using Java)
3. Installation
a. Download and Install Elasticsearch
- Linux/MacOS:
- Download the latest version from Elasticsearch Downloads
- Extract the tar file:
tar -zxvf elasticsearch-7.17.0-linux-x86_64.tar.gz
- Move into the extracted directory:
cd elasticsearch-7.17.0/
- Run Elasticsearch:
./bin/elasticsearch
- Windows:
- Download the latest version from Elasticsearch Downloads
- Extract the zip file
- Run Elasticsearch by executing
elasticsearch.bat
from thebin
folder.
b. Docker
Run Elasticsearch using Docker Compose by following the official documentation: https://www.elastic.co/blog/getting-started-with-the-elastic-stack-and-docker-compose. I’ve tried first with GPT Chat responses and wasted some time unsuccessfully.
4. Basic Operations
a. Authentication
By default Elastic Search is protected and you need to update the elastic user password with “.\elasticsearch-reset-password.bat -u elastic”. The password will be everything after New value: (printed on the command line).
https://www.elastic.co/guide/en/elasticsearch/reference/current/change-passwords-native-users.html. If you are using docker – the authentication is part of the .env file.
b. Verify Installation
To verify that Elasticsearch is running, navigate to https://localhost:9200/
in your web browser. Enter username elastic and password – the value from the command line. You will be able to see a JSON respose.
5. Monitoring and Management
a. Kibana
Kibana is a visualization tool for Elasticsearch. Download and install Kibana from Kibana Downloads.
After downloading the zip
- unzip it,
- from the elastic folder\bin – start .\elasticsearch-create-enrollment-token.bat -s kibana –url “https://localhost:9200”
- start kibana\bin\kibana-setup.bat
- paste the generated token
- wait a while until a it starts up (may take several minutes)
- kibana dashboard should be accessible on http://localhost:5601/ – with the same login as the prompted in “Verify Installation”
b. X-Pack
X-Pack extends Elasticsearch with security, alerting, monitoring, reporting, and graph capabilities and it comes build in Elasticsearch 7.0 and above.
Other tools
Could check out several tools in the official documentation https://www.elastic.co/blog/getting-started-with-the-elastic-stack-and-docker-compose that give nice visualizations and analytics. If you do – take into account that some of them are designed for linux and may not work on other OS.
10. Further Reading and Resources
For more advanced use cases, refer to the official documentation and explore the rich ecosystem of tools and plugins available for Elasticsearch.
I myself am planning to evolve a previous products by using elastic search service in the future.