kt-search

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

Deleting by query

KT Search Manual Previous: Highlighting Next: Document Manipulation
Github © Jilles van Gurp  

Delete by query is supported both on the client and the repository.

val repo = client.repository(indexName, TestDoc.serializer())
repo.bulk(refresh = Refresh.WaitFor) {
  create(TestDoc("1", "banana", price = 2.0))
  create(TestDoc("1", "apple", price = 1.0))
}

repo.deleteByQuery {
  query = match(TestDoc::name, "apple")
}.deleted

If you need the optional query parameters on this API, use client.deleteByQuery instead.


KT Search Manual Previous: Highlighting Next: Document Manipulation
Github © Jilles van Gurp