import method
Creates, updates or deletes
large amounts of documents
as fast as possible.
Implementation
Future<Map<String, dynamic>> import(
String index,
String collection,
List<Map<String, dynamic>> documents, {
bool waitForRefresh = false,
}) async {
final response = await kuzzle.query(KuzzleRequest(
action: 'import',
collection: collection,
controller: name,
index: index,
body: <String, dynamic>{
'bulkData': documents,
},
waitForRefresh: waitForRefresh,
));
final result = response.result as Map<String, dynamic>;
if (result['successes'] is List && result['errors'] is List) {
return result;
}
throw BadResponseFormatError(
response.error?.id, '$name.exists: bad response format', response);
}