deleteByQuery #
Deletes documents matching the provided search query.
Kuzzle uses the ElasticSearch Query DSL syntax.
:::: tabs ::: tab Java
Arguments #
public CompletableFuture<Int> deleteByQuery(
String index,
String collection,
Map<String, Object> searchQuery,
Boolean waitForRefresh
) throws NotConnectedException, InternalException
public CompletableFuture<Int> deleteByQuery(
String index,
String collection,
Map<String, Object> searchQuery
) throws NotConnectedException, InternalException
Argument | Type | Description |
---|---|---|
index | String | Index name |
collection | String | Collection name |
searchQuery | Map<String, Any?> | JSON representing the query to match |
waitForRefresh | Bool ( false ) | If set to true, Kuzzle will not respond until the delete documents are indexed |
Return #
An Int containing the number of deleted documents.
Usage #
Map<String, Object> term = new HashMap<String, Object>();
term.put("capacity", 7);
Map<String, Object> searchQuery = new HashMap<String, Object>();
searchQuery.put("query", term);
Integer result = kuzzle.getBulkController().deleteByQuery("nyc-open-data", "yellow-taxi", searchQuery).get();
::: ::: tab Kotlin
Arguments #
fun deleteByQuery(
index: String,
collection: String,
searchQuery: Map<String, Any?>,
waitForRefresh: Boolean? = null
): CompletableFuture<Int>
Argument | Type | Description |
---|---|---|
index | String | Index name |
collection | String | Collection name |
searchQuery | Map<String, Any?> | JSON representing the query to match |
waitForRefresh | Boolean ( false ) | If set to true, Kuzzle will not respond until the delete documents are indexed |
Return #
An Int containing the number of deleted documents.
Usage #
val searchQuery: Map<String, Any?> = HashMap<String, Any?>().apply {
put("query", HashMap<String, Any?>().apply {
put("term", HashMap<String, Any?>().apply {
put("capacity", 7)
})
})
}
val result: Int = kuzzle.bulkController.deleteByQuery("nyc-open-data", "yellow-taxi", searchQuery).get()
::: ::::
Edit this page on Github(opens new window)