kt-search icon indicating copy to clipboard operation
kt-search copied to clipboard

[FEAT] update by query

Open AlexRychkov opened this issue 1 year ago • 1 comments

Hello, in the first version of the lib it was possible to run an update by query with a script, but can't find similar functionality in current version

fun <T : Any> IndexRepository<T>.updateByQuery(
    esClient: RestHighLevelClient,
    script: Script,
    query: QueryBuilder,
) {
    val index = this.indexName
    val updateByQueryRequest = UpdateByQueryRequest(index)
    updateByQueryRequest.script = script
    updateByQueryRequest.setQuery(query)
    esClient.updateByQuery(
        updateByQueryRequest,
        RequestOptions.DEFAULT,
    )
}

AlexRychkov avatar May 11 '23 06:05 AlexRychkov