SDK
SDK Dart v2.x
2

deleteByQuery #

Deletes documents matching the provided search query.

Kuzzle uses the ElasticSearch Query DSL syntax.

Available since change-me

This method also supports the Koncorde Filters DSL to match documents by passing the lang argument with the value koncorde.
Koncorde filters will be translated into an Elasticsearch query.

Koncorde bool operator and regexp clause are not supported for search queries.

An empty or null query will match all documents in the collection.

Future<List<String> deleteByQuery(
    String index,
    String collection,
    Map<String, dynamic> query, {
    bool waitForRefresh = false,
    String lang
  })
ArgumentTypeDescription
index
String
Index name
collection
String
Collection name
searchQuery
Map<String, dynamic>
Query to match
waitForRefresh
bool

(false)
If set to true, Kuzzle will wait for the persistence layer to finish indexing
lang
String
Specify the query language to use. By default, it's elasticsearch but koncorde can also be used.
Available since change-me

Returns #

Returns a List<String> containing the deleted document ids.

Usage #

With the ElasticSearch Query DSL syntax.

final result = await kuzzle
  .document
  .deleteByQuery('nyc-open-data', 'yellow-taxi', {
    'query': {
      'match': {
        'capacity': 4
      }
    }
  });

With the Koncorde Filters DSL syntax.

final result = await kuzzle
  .document
  .deleteByQuery('nyc-open-data', 'yellow-taxi', {
    'query': {
      'equals': {
          'capacity': 4
        }
      }
    },
      lang: 'koncorde'
  );