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 (opens new window) syntax.


Arguments #

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

Argument Type Description
index
String
Index name
collection
String
Collection name
query
Map<String, dynamic>

({})
Query to match

Return #

Returns an int.

Usage #

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