Dart 2.x

updateMapping

Available since 1.7.1

You can define the collection dynamic mapping policy by setting the dynamic field to the desired value.

You can define collection additional metadata within the _meta root field.


Copied to clipboard!
Future<Map<String, dynamic>> updateMapping(
    String index,
    String collection,
    Map<String, dynamic> mapping,
  )

Arguments Type Description
index
String
Index name
collection
String
Collection name
mapping
Map<String, dynamic>
Describes the collection mapping

mapping

An object representing the collection data mapping.

This object must have a root field properties that contain the mapping definition:

More informations about database mappings here.

Returns

Returns a Map<String, dynamic>

Usage

Copied to clipboard!
await kuzzle
  .collection
  .updateMapping('nyc-open-data', 'yellow-taxi', {
    'dynamic': false,
    '_meta': {
      'area': 'Panipokhari',
    },
    'properties': {
      'plate': { 'type': 'keyword' },
      },
    });