A useful method of deleting a large set of documents without having to remove them individually.
How do you think it should be done?
A deleteBy or deletebyQuery function on the SearchClient (and perhaps on the IndexRepository that allows users to delete documents based on a query. I believe a large part of the searchDsl could be reused.
For the moment, I am using this extension function, but this is quite limited and I have only implemented everyting necessairy for my own purposes:
private suspend fun SearchClient.deleteByQuery(target: String?, block: (SearchDSL.() -> Unit)? = null): JsonObject {
val dsl = SearchDSL()
block?.invoke(dsl)
return this.restClient.post {
path(target, "_delete_by_query")
val rawJson = dsl.json()
if (rawJson.isNotBlank()) {
rawBody(rawJson)
}
}.parseJsonObject()
}
Will you be able to help with a pull request?
Given that this is my first time working with Elasticsearch (and this library, which works great by the way!), I doubt I can be of much assistance. Perhaps if this feature still missing after a while that I will try to tackle it.
Describe the enhancement
The
_delete_by_query
is not implemented yet.See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html#docs-delete-by-query-api-request
Why is this needed?
A useful method of deleting a large set of documents without having to remove them individually.
How do you think it should be done?
A
deleteBy
ordeletebyQuery
function on theSearchClient
(and perhaps on theIndexRepository
that allows users to delete documents based on a query. I believe a large part of the searchDsl could be reused.For the moment, I am using this extension function, but this is quite limited and I have only implemented everyting necessairy for my own purposes:
Will you be able to help with a pull request? Given that this is my first time working with Elasticsearch (and this library, which works great by the way!), I doubt I can be of much assistance. Perhaps if this feature still missing after a while that I will try to tackle it.