update method

Future<Map<String, dynamic>> update(
  1. String index,
  2. String collection,
  3. String id,
  4. Map<String, dynamic> document, {
  5. bool waitForRefresh = false,
  6. int? retryOnConflict,
  7. bool? source,
})

####Updates a document content.

index: index name \
collection: collection name \
uid: unique identifier of the document to update \
document: document as Map<String, dynamic> \\

Optional

waitForRefresh: if set to wait_for, Kuzzle will not respond until the update is indexed \
retryOnConflict: conflicts may occur if the same document gets updated multiple times within a short timespan, in a database cluster. You can set the retryOnConflict optional argument (with a retry count), to tell Kuzzle to retry the failing updates the specified amount of times before rejecting the request with an error. \
source: if set to true Kuzzle will return the updated document body in the response \\

Implementation

Future<Map<String, dynamic>> update(
  String index,
  String collection,
  String id,
  Map<String, dynamic> document, {
  bool waitForRefresh = false,
  int? retryOnConflict,
  bool? source,
}) async {
  final response = await kuzzle.query(KuzzleRequest(
    controller: name,
    action: 'update',
    index: index,
    collection: collection,
    uid: id,
    body: document,
    waitForRefresh: waitForRefresh,
    source: source,
    retryOnConflict: retryOnConflict,
  ));

  return response.result as Map<String, dynamic>;
}