In this project, We will show how Spring boot can intract with Elasticsearch Engine using TransportClient. This project uses elasticsearch client jar 5.0.0 version with ElasticSearch Engine 5.5.0. Don't use ElasticSearch 5.x and above with spring-data-elasticsearch as it is not updated yet with If you want to see how spring-data-elasticsearch interact with Elasticsearch Engine, check this blog for details -https://www.rajeshbhojwani.co.in/2018/12/overview-elasticsearch-real-time.html
git clone https://github.com/RajeshBhojwani/spring-boot-standalone-elasticsearch.git
mvn clean install
java -jar target\standalone-elasticsearch-0.0.1-SNAPSHOT.jar
- POST call for creating new Index "users", type "employee" and document. http://localhost:8102/rest/users/create
{
"userId":"1",
"name": "Sumit",
"userSettings": {
"gender" : "male",
"occupation" : "CA",
"hobby" : "chess"
}
}
- GET call to retrive particular User with id.
http://localhost:8102/rest/users/view/1
-
update field of the document by user id. http://localhost:8102/rest/users/update/1
-
delete field of the document by user id. http://localhost:8102/rest/users/delete/1
For detail explanation of this project check this blog - https://www.rajeshbhojwani.co.in/2018/12/spring-boot-elasticsearch.html