- Notifications
You must be signed in to change notification settings - Fork6
kuldeepsingh99/springboot-elasticsearch
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
In this example, we will discuss about How to create a Spring Boot, Spring Data and Elasticsearch Example.
- Spring Boot
- Spring Boot Starter Data Elasticsearch
- Elasticsearch 2.4
- Kibana 4.6
SpringBoot 1.5.*.RELEASE supports only ElasticSearch 2.4.0. They don’t support the latest version of ElasticSearch 5.x version. Read this –Spring Data Elasticsearch Spring Boot version matrix andELK Compatibility
Run this command in the docker container to install elastic search
docker run -d -it --name kuldeep -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -m 1500m elasticsearch:2.4
Run this command in the docker container to install kibana
docker run -d -it --name kibanak --link kuldeep:elasticsearch -p 5601:5601 kibana:4.6
Checking with docker ps command, all their container should be running
Download the code and import it to Eclipse or any Id
Run the project and make sure Java Container is able to connect Elastic Search
Call the SaveContact URL (http://localhost:8080/user/savecontact) to create a record
POST /user/savecontact HTTP/1.1Host: localhost:8080Content-Type: application/jsonCache-Control: no-cachePostman-Token: 1d8e66f0-ea57-5ea5-4b6a-d9be1c751812
{"id":"4","contactId":"104","name": "hello4","email":"hello4@123.com","company":"xcompany","contactType":"3"}
- Access the Kibana URLhttp://192.168.99.100:5601/app/kibana and go to Settings -> Indices
- Next Step is to create Index, type contacts in the textbox and uncheck the "Index contains time based events"
- Once Index is created we can check all the fields mentioned in bean has been created
- Finally we can go to discover tab to check the data
We can do all the CRUD Operation here.
About
Spring Boot Spring Data and Elastic Search example
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.