count #
Counts documents in a collection.
A query can be provided to alter the count result, otherwise returns the total number of documents in the collection.
Kuzzle uses the ElasticSearch Query DSL syntax.
Arguments #
public CompletableFuture<Integer> count(
final String index,
final String collection)
throws NotConnectedException, InternalException
public CompletableFuture<Integer> count(
final String index,
final String collection,
final ConcurrentHaspMap<String, Object> searchQuery)
throws NotConnectedException, InternalException
Argument | Type | Description |
---|---|---|
index | String | Index name |
collection | String | Collection name |
searchQuery | ConcurrentHashMap<String, Object> | Query to match |
Return #
Returns an Integer.
Usage #
ConcurrentHashMap<String, Object> searchQuery = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> match = new ConcurrentHashMap<>();
match.put("Hello", "Clarisse");
searchQuery.put("match", match);
Integer result = kuzzle
.getDocumentController()
.count("nyc-open-data", "yellow-taxi", searchQuery)
.get();
Edit this page on Github(opens new window)