SDK
SDK Java v2.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.

collectionMapping #

Creates a new CollectionMapping object, using its constructor.


collectionMapping([mapping]) #

ArgumentsTypeDescription
mappingJSON ObjectOptional mapping

Return Value #

Returns the newly created CollectionMapping object.

Usage #

CollectionMapping dataMapping = kuzzle
  .collection("collection", "index")
  .collectionMapping(new JSONObject().put("someFiled", new JSONObject().put("type", "string").put("index", "analyzed"))
  .apply(new ResponseListener<CollectionMapping>() {
    @Override
    public void onSuccess(CollectionMapping object) {
      // called once the mapping action has been completed
    }
    @Override
    public void onError(JSONObject error) {
      // Handle error
    }
  });