Giter Site home page Giter Site logo

ogz00 / spring-boot-kotlin-elasticsearch-restful Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 3.0 81 KB

Restful Spring Boot - Kotlin - Elasticsearch 5 Docker with Spring Data & Java Api

Kotlin 100.00%
kotlin elasticsearch spring-boot spring-actuator gradle spring-data-jpa postgresql elasticsearch5 elasticsearch-java-api

spring-boot-kotlin-elasticsearch-restful's Introduction

spring-boot-kotlin-elasticsearch-restful

Spring Boot Kotlin Application Example with Spring-Data-Jpa and Elasticsearch Java API in Docker container.

Also Spring Actuator integretion with Kotlin.

Elasticsearch Create Index Template

Create an Elasticsearch Template with following command:

curl -XPUT -u elastic:changeme 'localhost:9200/template/people_1?pretty' -H 'Content-Type: application/json' -d'
{
"template": "people_1
*", "settings": { "number_of_shards": 1, "refresh_interval": "3s" },
"mappings": {
"people_type": { "_source": { "enabled": true }, "properties": { "id": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above":256 } } }, "name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above":256 } } }, "surname": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above":256 } } }, "username": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above":256 } } }, "age": { "type": "integer" }, "created_at": { "type": "date" } } } }, "aliases": {} } '

Elasticsearch post new document to people_1_june index

curl -XPUT -u elastic:changeme 'localhost:9200/people_1_june/people_type' -H 'Content-Type: application/json' -d' { "id": "3d7797e5-736f-441a-8a13-9a997ee71e17", "age": 27, "name": "oguzhan", "surname":"karacullu", "username":"mete00", "created_at": "2017-06-17" }
'

  • After creating the ES indexes and documents,

  • first change "application.yml" then,

  • gradle clean

  • gradle build

  • gradle bootRun

Create Person with RestApi:

curl -H "Content-Type: application/json" -X POST -d '{"name": "Oguzhan","surname": "Karacullu","username": "oguz00","age": 27}' http://localhost:8080/person

Get All Person from ES index with Java Api if exist, else getter from local PostgreSql DB

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET 'http://localhost:8080/person/all'

spring-boot-kotlin-actuator

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET 'http://localhost:8080/details'

For Example Monitoring Endpoints: -X GET 'http://localhost:8080/details/mappings'

  • PS: Continue to integration elasticsearch impl.

spring-boot-kotlin-elasticsearch-restful's People

Contributors

ogz00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spring-boot-kotlin-elasticsearch-restful's Issues

Cleanup non issue

When my account was compromised a spam issue was created in this repo. I sincerely apologize. Cleaning up such issues via script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.