SDK
SDK Dart v2.x
2

mWrite #

This is a low level route intended to bypass Kuzzle actions on document creation, notably:

Arguments #

Future<Map<String, dynamic>> import(
      String index, 
      String collection, 
      List<Map<String, dynamic>> documents,
      {
        bool waitForRefresh = false,
      })
ArgumentTypeDescription
index
String
Index name
collection
String
Collection name
documents
List<Map<String, dynamic>>
An array of Map<String, dynamic> representing the documents
waitForRefresh
bool

(false)
If set to true, Kuzzle will not respond until the created/replaced documents are indexed

documents #

An array of Map<String, dynamic>. Each object describes a document to create or replace, by exposing the following properties:

  • _id: document unique identifier (optional)
  • body: document content

Return #

Returns a Map<String, dynamic> containing 2 arrays: successes and errors

Each created or replaced document is an object of the successes array with the following properties:

NameTypeDescription
_id
String
Document ID
_version
int
Version of the document in the persistent data storage
_source
Map<String, dynamic>
Document content
created
bool
True if the document was created

Each errored document is an object of the errors array with the following properties:

NameTypeDescription
document
Map<String, dynamic>
Document that cause the error
status
int
HTTP error status
reason
String
Human readable reason

Usage #

final result = await kuzzle
  .bulk
  .mWrite(
    'nyc-open-data',
    'yellow-taxi',
    [
      {'_id': 'foo', 'body': {},},
    ]);