This document provides step-by-step instructions to set up Elasticsearch on Linux and Windows, along with common operations such as creating an index, syncing data, and searching data.
1. Prerequisites
Java (Elasticsearch 8.x comes with bundled JDK – no separate Java install required)
Minimum 4 GB RAM (recommended)
Open ports: 9200 (HTTP), 9300 (Transport)
2. Elasticsearch Installation
2.1 Linux Setup (Ubuntu / RHEL)
Step 1: Download Elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.x.x-linux-x86_64.tar.gzStep 2: Extract the Archive
tar -xzf elasticsearch-8.x.x-linux-x86_64.tar.gz
cd elasticsearch-8.x.x
Step 3: Configure Elasticsearch
Edit config/elasticsearch.ymlcluster.name: elasticsearch-cluster
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
discovery.type: single-node
Step 4: Start Elasticsearch
./bin/elasticsearch
Step 5: Verify Installation
curl http://localhost:9200
2.2 Windows Setup
Step 1: Download Elasticsearch
Download the Windows ZIP from Elastic official site
Step 2: Extract ZIP File
Extract to a directory (example:
C:\elasticsearch)
Step 3: Configure Elasticsearch
Edit config\elasticsearch.yml
cluster.name: elasticsearch-cluster
node.name: node-1
network.host: localhost
http.port: 9200
discovery.type: single-node
Step 4: Start Elasticsearch
bin\elasticsearch.bat
Step 5: Verify Installation
Open browser or Postman:
http://localhost:9200
2.3 Docker Setup
Step 1: Create docker-compose.yml
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.12.0
container_name: amrit-elasticsearch
environment:
- node.name=es-amrit
- cluster.name=amrit-cluster
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- xpack.security.enabled=true
- xpack.security.http.ssl.enabled=false
- xpack.security.transport.ssl.enabled=false
- ELASTIC_PASSWORD=Password
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- es-data:/usr/share/elasticsearch/data
ports:
- "9200:9200"
- "9300:9300"
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "curl -s http://localhost:9200 >/dev/null || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60skibana:
image: docker.elastic.co/kibana/kibana:8.12.0
container_name: amrit-kibana
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
- ELASTICSEARCH_USERNAME=elastic
- ELASTICSEARCH_PASSWORD=Password
- SERVER_HOST=0.0.0.0
ports:
- "5601:5601"
networks:
- app-network
depends_on:
elasticsearch:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -s http://localhost:5601/api/status >/dev/null || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
Step 2: Start Elasticsearch Container
docker compose up -d