SDK
SDK Dart Null Safety v3.x
2

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 #

Future<int> count(
    String index,
    String collection,
    {
    Map<String, dynamic> query = const {}
})

ArgumentTypeDescription
index
String
Index name
collection
String
Collection name
query
Map<String, dynamic>

({})
Query to match

Return #

Returns an int.

Usage #

final result = await kuzzle
  .document
  .count('nyc-open-data', 'yellow-taxi', query: {
    'query': {
      'match': {
        'Hello': 'Clarisse',
      },
    },
  });