SDK
SDK Dart v2.x
2

write #

Create or replace a document directly into the storage engine.

Arguments #

Copied to clipboard!
Future<Map<String, dynamic>> write(
      String index, 
      String collection, 
      Map<String, dynamic> document, {
        String id,
        bool waitForRefresh = false,
      })
Argument Type Description
index
String
Index name
collection
String
Collection name
content
Map<String, dynamic>
Document content to create.
id
String

(null)
Document id
waitForRefresh
bool

(false)
If set to true, Kuzzle will wait for the persistence layer to finish indexing

Return #

Returns a Map<String, dynamic> with the following properties:

Property Type Description
_id
String
Created document unique identifier.
_source
Map<String, dynamic>
Document content.
_version
int
Version number of the document

Usage #

Copied to clipboard!
final result = await kuzzle
  .bulk
  .write(
    'nyc-open-data',
    'yellow-taxi',
    {
      '_kuzzle_info': {
        'author': '<kuid>',
        'createdAt': 1481816934209,
        'updatedAt': null,
        'updater': null,
      }
    });