kt-search

Multi platform kotlin client for Elasticsearch & Opensearch


Project maintained by jillesvangurp Hosted on GitHub Pages — Theme by mattgraham

Jupyter Notebooks

Using kt-search from jupyter and the kotlin kernel is easy! See the jupyter-example directory in the kt-search project.

Install conda

On a mac, use home brew of course.

brew install miniconda

Install jupyter with conda

Once you have conda installed, install jupyter and the kotlin kernel.

 conda install jupyter
 conda install -c jetbrains kotlin-jupyter-kernel

Open the notebook

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://maven.tryformation.com/releases")
@file:DependsOn("com.jillesvangurp:search-client-jvm:1.99.13")

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.