update method

Future<Map<String, dynamic>> update(
  1. String index,
  2. String collection,
  3. Map<String, dynamic> mappings,
  4. Map<String, dynamic> settings,
)

Updates a data collection data mappings. TODO: check if mappings/settings are optional or both are necessary

Warning: While updating the collection settings, the collection will be closed until the new configuration has been applied.

Implementation

Future<Map<String, dynamic>> update(
  String index,
  String collection,
  Map<String, dynamic> mappings,
  Map<String, dynamic> settings,
) async {
  final body = <String, dynamic>{};

  if (mappings != null) {
    body['mappings'] = mappings;
  }

  if (settings != null) {
    body['settings'] = settings;
  }

  final response = await kuzzle.query(KuzzleRequest(
    index: index,
    collection: collection,
    controller: name,
    action: 'update',
    body: body,
  ));

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