Spring boot -Elastic Search – Setup and CRUD

Step 1: Understanding Elasticsearch

  • What is Elasticsearch?
    Elasticsearch is a distributed, RESTful search and analytics engine capable of handling large volumes of data in near real-time. It’s commonly used for search functionality, log analysis, and data visualization.
  • Core Concepts:
  • Index: Like a database in RDBMS. It stores related documents.
  • Document: A single unit of data, stored in JSON format.
  • Shard & Replica: A shard is a subset of an index; replicas are backups of shards.

Step 2: Setup Elasticsearch

1. Install Elasticsearch

  • Download the latest version from Elasticsearch Downloads.
  • Unzip the downloaded package.
  • Run Elasticsearch:
    • Linux/Mac: ./bin/elasticsearch
    • Windows: bin\elasticsearch.bat
    • config folder -> elasticsearch.yml -> set security to false
    • default username – elastic
    • default password – shows in logs
      Note – Navigate to the Elasticsearch bin directory.
      Run this command: elasticsearch-reset-password -u elastic
      Follow the prompts to set a new password.
  • Verify it’s running: Open http://localhost:9200 in a browser or use curl:
    bash curl -X GET "localhost:9200/"

Note – To allow traffic on port 9200 for Elasticsearch in Windows, you need to create a firewall rule. Here’s how to do it:
Steps to Allow Inbound Traffic on Port 9200
Open Windows Defender Firewall:
Press Windows + R to open the Run dialog.
Type control and press Enter to open the Control Panel.
Navigate to System and Security > Windows Defender Firewall.
Advanced Settings:
On the left side, click on Advanced settings. This opens the Windows Defender Firewall with Advanced Security window.
Create a New Inbound Rule:
In the left pane, select Inbound Rules.
In the right pane, click on New Rule….
Select Rule Type:
Choose Port and click Next.
Specify Port and Protocol:
Select TCP.
In the Specific local ports field, enter 9200.
Click Next.
Allow the Connection:
Choose Allow the connection and click Next.
Profile Selection:
Select when this rule applies (Domain, Private, Public). It’s usually safe to select all three if you are on a private network.
Click Next.
Name the Rule:
Give your rule a name (e.g., “Elasticsearch Port 9200”).
Optionally, add a description.
Click Finish.
Verify the Rule is Active:
Ensure that your new rule appears in the list of inbound rules and is enabled (it should be checked).

Github Project link – https://github.com/kuldeep101990/Spring-Boot-Elastic-Search

3 comments

  1. On this platform, you can find lots of online slots from leading developers.
    Players can try out traditional machines as well as feature-packed games with stunning graphics and exciting features.
    If you’re just starting out or a seasoned gamer, there’s something for everyone.
    play aviator
    Each title are ready to play anytime and designed for laptops and tablets alike.
    No download is required, so you can start playing instantly.
    Site navigation is intuitive, making it quick to find your favorite slot.
    Register now, and discover the world of online slots!

  2. On this platform, you can find a wide selection of casino slots from leading developers.
    Users can enjoy classic slots as well as new-generation slots with high-quality visuals and bonus rounds.
    If you’re just starting out or an experienced player, there’s something for everyone.
    slot casino
    The games are available anytime and optimized for PCs and mobile devices alike.
    No download is required, so you can start playing instantly.
    Platform layout is user-friendly, making it convenient to find your favorite slot.
    Join the fun, and dive into the excitement of spinning reels!

Leave a Reply

Your email address will not be published. Required fields are marked *