Multi platform kotlin client for Elasticsearch & Opensearch with easily extendable Kotlin DSLs for queries, mappings, bulk, and more.

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

KT Search Manual

Kt-search is a Kotlin Multi Platform library to search across the Opensearch and Elasticsearch ecosystem on any platform that kotlin can compile to. It provides Kotlin DSLs for querying, defining mappings, bulk indexing, index templates, index life cycle management, index aliases, and much more. The key goal for this library is to provide a best in class developer experience for using Elasticsearch and Opensearch.

Table of contents


What is Kt-Search

Getting Started

Client Configuration

Indices, Settings, Mappings, and Aliases

Search and Queries

Text Queries

Term Level Queries

Compound Queries

Geo Spatial Queries

Specialized Queries


Deep Paging Using search_after and scroll

Join Queries


Indices and Documents

Deleting by query

Document Manipulation

Index Repository

Efficiently Ingest Content Using Bulk Indexing

Creating Data Streams

Advanced Topics

KNN Search

Extending the Json DSLs

Using Kotlin Scripting

Jupyter Notebooks

Migrating from the old Es Kotlin Client

About this Manual

This manual documents how to use the kotlin search client and all of its features. As a manual like this contains a lot of code samples, I ended up writing a mini framework to allow me to generate markdown from Kotlin.

The project for this is called Kotlin4Example. Most of the documentation you will find here has correct code samples that get tested and compiled whenever this project is built and whenever something gets refactored that would affect one of the code samples.

There are several libraries that build on kt-search:

Additionally, I also maintain a few other search related projects that you might find interesting.