https://github.com/hrishabh3829/course-search-spring
Course Search Backend (Spring Boot + Elasticsearch)
https://github.com/hrishabh3829/course-search-spring
spring-boot springweb
Last synced: about 1 month ago
JSON representation
Course Search Backend (Spring Boot + Elasticsearch)
- Host: GitHub
- URL: https://github.com/hrishabh3829/course-search-spring
- Owner: Hrishabh3829
- Created: 2025-07-14T12:47:08.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-07-14T13:05:45.000Z (11 months ago)
- Last Synced: 2025-07-14T16:52:00.499Z (11 months ago)
- Topics: spring-boot, springweb
- Language: Java
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
π― Course Search Backend (Spring Boot + Elasticsearch)
This is a lightweight backend application for searching and filtering courses using Elasticsearch. It supports full-text search, autocomplete, and optional fuzzy matching β built with Spring Boot, Java 17, and tested using Testcontainers.
π Getting Started
1. Prerequisites
- β
Java 17
- β
Maven 3+
- β
Docker (for Elasticsearch container)
2. Clone the Repository
git clone https://github.com/your-username/course-search.git
cd course-search
3. Start Elasticsearch with Docker Compose
docker-compose up -d
4. Run the Spring Boot Application
./mvnw spring-boot:run
5. Verify Initialization
You should see:
πCourses indexed into Elasticsearch: 50
π Features
- π Full-text search (title, description, category)
- β‘ Autocomplete suggestions (prefix-based)
- π€ Fuzzy matching for typo-tolerance
- π 50 sample courses indexed at startup
- π§ͺ Integration tests using Testcontainers + JUnit 5
π§± Tech Stack
TechVersion
Java17
Spring Boot3.2+
Elasticsearch7.17
Spring Data ESβ
Jacksonβ
Testcontainers1.19.0
JUnit 55.12.2
ποΈ Project Structure
src/
βββ main/
β βββ java/com/example/coursesearch/
β β βββ config/ # Jackson & other app-level configs
β β βββ controller/ # API endpoints
β β βββ document/ # Elasticsearch @Document definitions
β β βββ repository/ # Spring Data Elasticsearch repositories
β β βββ service/ # Business logic (search, indexing)
β βββ resources/
β βββ application.yml
β βββ sample-courses.json # Initial 50-course dataset
βββ test/ # Integration testing with Testcontainers
π API Endpoints
EndpointMethodDescription
/api/search?q=keyword
GET
Full-text search across title, description, category
/api/search/suggest?q=term
GET
Autocomplete suggestions using Elasticsearch completion field
π§ͺ Running Tests
./mvnw test
This project uses Testcontainers to spin up a real Elasticsearch instance. Useful to ensure your logic works on actual Elasticsearch behavior.
π How to Use This Project
- Clone the repo
- Start Elasticsearch using
docker-compose up -d
- Run the Spring Boot backend using
./mvnw spring-boot:run
- Open Postman or your browser and hit:
http://localhost:9090/api/search?q=math
http://localhost:9090/api/search/suggest?q=art
π Contributing
This project is beginner-friendly. You are welcome to fork the repo and open PRs for improvements or suggestions.
π Acknowledgement
Built as a learning project to explore Spring Boot and Elasticsearch integration. Thanks to the developer community for docs, samples, and support.
π€ Author
Maintained by Hrishabh.
Built with passion, patience, and a focus on clean backend design.