This sample project demonstrates the usage of the Spring Data OpenSearch in the typical Spring Boot web application. The application assumes that there is an OpenSearch service up and running on the local machine, available at https://localhost:9200
(protected by basic authentication with default credentials).
- The easiest way to get OpenSearch service up and running is by using Docker:
docker run -p 9200:9200 -e "discovery.type=single-node" opensearchproject/opensearch:2.4.0
- Build and run the project using Gradle:
./gradlew :spring-data-opensearch-examples:spring-boot-gradle:bootRun
-
Exercise the REST endpoint available at:
http://localhost:8080/marketplace
- Fetch all products:
curl 'http://localhost:8080/marketplace/search'
- Search products by name:
curl 'http://localhost:8080/marketplace/search?name=pillow'
- Search products by name and price greater than:
curl 'http://localhost:8080/marketplace/search?name=pillow&price=35.0'
- Fetch all products: