Simple Spring Boot application demonstrating Hibernate Search 6 usage with Elasticsearch.
Hibernate Search 6.1.7.Final: Reference Documentation
ER diagram:
Full text search is available for Freelancer and Project entities.
Indexing Entities
3 search examples:
-
searchProjectsEntities demonstrates basic full text search of projects by
- project name
-
searchProjects demonstrates previous example with projections usage
-
searchFreelancers demonstrates full text search of freelancers (with projections) by
- username
- first name
- last name
- categories (M:N relationship)
Creating custom edgeNgram analyser
Before running Spring Boot application start necessary Docker containers with the following commands:
-
Start development environment with:
docker compose -f deployment/docker-compose-dev.yaml up -d
-
Stop development environment with:
docker compose -f deployment/docker-compose-dev.yaml down
Run tests with the following command:
newman run ./backend/src/test/postman/Hibernate-search-6-example.postman_collection.json -e ./backend/src/test/postman/Test\ Environment.postman_environment.json --reporters cli,json --reporter-json-export ./backend/src/test/postman/output/outputfile.json
Import postman collection from here
Elasticsearch browser extension: https://elasticvue.com/
- Paginated fetching of child entities over parent entity at unidirectional OneToMany relationship
- Mapping only required fields with MapStruct by defining multiple mappers for sam entity
- Don't pass entities outside @Transactional method, return DTO instead.
- Avoiding the N+1 SELECT problem using @EntityGraph
- Mapstruct ignoring child bean fields