SDK
SDK PHP v3.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

set #

Adds or updates a field mapping.

Changes made by this function won't be applied until you call the apply method.


set(field, mapping) #

ArgumentsTypeDescription
fieldstringName of the field from which the mapping is to be added or updated
mappingJSON ObjectMapping for this field, following the Elasticsearch Mapping format

Return Value #

Returns this CollectionMapping object to allow chaining.

Usage #

<?php
use \Kuzzle\DataMapping;
// ...
$field = 'field';
$mapping = [
  'type' => 'string',
  'index' => 'analyzed',
  'null_value' => ''
];
/**
  * @var $dataMapping DataMapping
  */
$dataMapping->set($field, $mapping);