- webflux, kotlin, coroutine, functional, swagger, elasticsearch
# exec elasticsearch, kibana
$ es/docker-compose up
# insert init data
$ sh es/migrate.sh
- Without Spring Data Elasticserach or ELastic Rest High Level Client
- Using WebClient and raw Query
fun searchRecipes(keywords: String, size: Int): Flow<Any> = webClient
.post()
.uri("/omtm/recipe/_search")
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
.bodyValue("""
{
"query": {
"multi_match": {
"query": "$keywords",
"fields": ["description","title^0.5"]
}
},
"size": $size
}
""".trimIndent())
.retrieve()
.bodyToFlux(Any::class.java)
.asFlow()
- apply validator to check request params
- ecs task definition for auto deploy
- optimize coroutine for async
- optimize ES architecture, query