SDK
SDK Java v3.x
2

This SDK is deprecated. We recommend to use the Kuzzle SDK-JVM.
A migration guide is available here

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 #

Copied to clipboard!
public CompletableFuture<Integer> count(
      final String index,
      final String collection)
throws NotConnectedException, InternalException

Copied to clipboard!
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 #

Copied to clipboard!
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();