deleteByQuery #
Deletes documents matching the provided search query.
Kuzzle uses the ElasticSearch Query DSL syntax.
An empty or null query will match all documents in the collection.
public CompletableFuture<ArrayList<String>> deleteByQuery(
final String index,
final String collection,
final ConcurrentHashMap<String, Object> searchQuery) throws NotConnectedException, InternalException
public CompletableFuture<ArrayList<String>> deleteByQuery(
final String index,
final String collection,
final ConcurrentHashMap<String, Object> searchQuery,
final Boolean waitForRefresh) throws NotConnectedException, InternalException
Argument | Type | Description |
---|---|---|
index | String | Index name |
collection | String | Collection name |
searchQuery | ConcurrentHashMap<String, Object> | Query to match |
waitForRefresh | Boolean(optional) | If set to true , Kuzzle will wait for the persistence layer to finish indexing |
Returns #
Returns an ArrayList<String>
containing the deleted document ids.
Usage #
ConcurrentHashMap<String, Object> searchQuery = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> query = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> match = new ConcurrentHashMap<>();
match.put("capacity", 4);
query.put("match", match);
searchQuery.put("query", query);
ArrayList<String> result = kuzzle
.getDocumentController()
.deleteByQuery("nyc-open-data", "yellow-taxi", searchQuery)
.get();
Edit this page on Github(opens new window)