Skip to content

Elasticsearch Product Search Demo A full-stack application demonstrating Elasticsearch functionality with a Google-like product search interface. Built with Vue.js, Express.js, and Elasticsearch.

Notifications You must be signed in to change notification settings

hadarisas/elasticsearch-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elasticsearch Product Search Demo

A full-stack application demonstrating Elasticsearch functionality with a Google-like product search interface. Built with Vue.js, Express.js, and Elasticsearch.

Demo Screenshots

Search Demo Search demo

Health Check

Health Check Health check endpoint to ensure the application is running

Home Page (Google-like)

Home Page Initial search interface with Google-like design

Exact Match

Exact Match Exact match search results

Fuzzy Match - Typo with suggestions

Fuzzy Match Fuzzy match search results (with typo)

Search Pagination

Search Pagination Search results pagination

Kibana Dashboard - Document List

Kibana Dashboard - Document List Search suggestions as you type

Kibana Dashboard - Document Details

Kibana Dashboard - Document Details Kibana dashboard showing document details

Kibana Dashboard - Document Details Kibana dashboard showing document details

Kibana Dashboard - Product Index Settings

Kibana Dashboard - Product Index Settings Kibana dashboard showing product index settings

Kibana Dashboard - Product Index Mapping

Kibana Dashboard - Product Index Mapping Kibana dashboard showing product index mapping

Features

  • 🔍 Real-time product search with exact and fuzzy matching (with suggestions in typo cases)
  • 💡 Search suggestions as you type
  • 📱 Responsive Google-like interface
  • 📊 Search results pagination
  • ⚡ Fast search performance
  • 📈 Kibana integration for data visualization

Prerequisites

Before you begin, ensure you have the following installed:

Quick Start

  1. Clone the repository:
git clone https://github.com/hadarisas/elasticsearch-demo.git
cd elasticsearch-demo
cp server/env_example server/env
  1. Start the application using Docker Compose:
docker compose up -d
  1. Wait for all services to start (this may take a few minutes on first run). You can check the status with:
docker compose ps
  1. Access the application:

Architecture

The application consists of four main components:

  • Frontend (Vue.js): A responsive web interface running on port 8080
  • Backend (Express.js): REST API server running on port 3001
  • Elasticsearch: Search engine running on port 9200
  • Kibana: Data visualization platform running on port 5601

Development Setup

If you want to modify the code and run the services individually:

  1. First, start Elasticsearch and Kibana using the development Docker Compose file:
docker compose -f docker-compose.copy.yml up -d
  1. Set up the Frontend:
cd client
npm install
npm run dev

The frontend will be available at http://localhost:5173

  1. Set up the Backend:
cd server
cp .env.example .env    # Configure your environment variables
npm install
npm run dev

The backend will be available at http://localhost:3001

Note: For development, we use docker-compose.copy.yml which only runs Elasticsearch and Kibana services. This allows you to run the frontend and backend services locally while still connecting to the containerized search infrastructure.

API Endpoints

Search Products

  • URL: /api/search
  • Method: GET
  • Query Parameters:
    • q: Search query
    • page: Page number (default: 1)
    • limit: Results per page (default: 5)
  • Example: http://localhost:3001/api/search?q=iphone&page=1&limit=5

Health Check

  • URL: /health
  • Method: GET
  • Example: http://localhost:3001/health

Docker Images

The application uses the following Docker images:

  • Frontend: hadarisas/elasticsearch-demo-client:1.0
  • Backend: hadarisas/elasticsearch-demo-server:1.0
  • Elasticsearch: docker.elastic.co/elasticsearch/elasticsearch:8.12.0
  • Kibana: docker.elastic.co/kibana/kibana:8.12.0

Troubleshooting

  1. Services not starting:

    # Check service logs
    docker compose logs -f
  2. Elasticsearch not healthy:

    # Check Elasticsearch status
    curl http://localhost:9200/_cluster/health
  3. Reset everything and start fresh:

    docker compose down -v
    docker compose up -d

Data Management

The application comes with pre-loaded sample product data. The data is automatically initialized when the server starts. If you need to reset the data:

  1. Stop the containers:

    docker compose down
  2. Remove the volume:

    docker volume rm elasticsearch-demo_elasticsearch-data
  3. Restart the application:

    docker compose up -d

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

EL HADRI HASSAN - hadarisas@gmail.com

Project Link: https://github.com/hadarisas/elasticsearch-demo

Acknowledgments

About

Elasticsearch Product Search Demo A full-stack application demonstrating Elasticsearch functionality with a Google-like product search interface. Built with Vue.js, Express.js, and Elasticsearch.

Topics

Resources

Stars

Watchers

Forks