Multi platform kotlin client for Elasticsearch & Opensearch with easily extendable Kotlin DSLs for queries, mappings, bulk, and more.
KT Search Manual | Previous: Using Kotlin Scripting | Next: Migrating from the old Es Kotlin Client |
Github | © Jilles van Gurp |
Using kt-search from jupyter and the kotlin kernel is easy! See the jupyter-example
directory in the kt-search project.
On a mac, use home brew of course.
brew install miniconda
Once you have conda installed, install jupyter and the kotlin kernel.
conda create -n kjupyter
conda activate kjupyter
conda install jupyter
conda install -c jetbrains kotlin-jupyter-kernel
Now you are ready to open the notebook!
cd jupyter-example
jupyter notebook kt-search-example.ipynb
Create a cell in your notebook with something like this:
@file:Repository("https://jitpack.io")
@file:DependsOn("com.github.jillesvangurp.kt-search:search-client:1.99.14")
import com.jillesvangurp.ktsearch.*
import kotlinx.coroutines.runBlocking
val client = SearchClient(
KtorRestClient(
host = "localhost",
port = 9200
)
)
runBlocking {
val engineInfo = client.engineInfo()
println(engineInfo.variantInfo.variant.name + ":" + engineInfo.version.number)
}
Note, you need to use runBlocking
to use suspending calls on the client.
Otherwise, see the documentation for how to use the kotlin scripting support.
KT Search Manual | Previous: Using Kotlin Scripting | Next: Migrating from the old Es Kotlin Client |
Github | © Jilles van Gurp |