SDK
SDK Java v2.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

count #

Returns the number of documents matching the provided set of filters.

There is a small delay between the time a document is created and its availability in our search layer (usually a couple of seconds). That means that a document that was just created might not be immediately returned by this function.


count(filters, [options], callback) #

Arguments Type Description
filters JSON Object Filters in ElasticSearch Query DSL (opens new window) format
options JSON Object Optional parameters
callback function Callback handling the response

Options #

Option Type Description Default
queuable boolean Make this request queuable or not true

Callback Response #

Returns a count for the number of document matches as an integer.

Usage #

Copied to clipboard!
JSONObject filters = new JSONObject();
kuzzle
  .collection("collection", "index")
  .count(filters, new ResponseListener<Integer>() {
    @Override
    public void onSuccess(Integer object) {
      // Handle success
    }
    @Override
    public void onError(JSONObject error) {
      // Handle error
    }
  });

Callback response:

Copied to clipboard!
12