SDK
SDK Java v3.x
2

This SDK is deprecated. We recommend to use the Kuzzle SDK-JVM.
A migration guide is available here

update #

Available since Kuzzle 2.1.0

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.


  public CompletableFuture<Void> update(
      final String index,
      final String collection,
      final ConcurrentHashMap<String, Object> mapping)

ArgumentsTypeDescription
index
String
Index name
collection
String
Collection name
mapping
ConcurrentHashMap<String, Object>
Describes the collection mapping

mapping #

A ConcurrentHashMap<String, Object> representing the collection data mapping.

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

{
  mappings={
    dynamic="[true|false|strict]",
    _meta={
      field="value"
  },
    properties={
      field1={ type='text' },
      field2={
        properties={
          nestedField={ type='keyword' }
        }
      }
    }
  }
};

More information about database mappings here.

Returns #

Returns a CompletableFuture<Void>.

Usage #

ConcurrentHashMap<String, Object> mapping = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> properties = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> license = new ConcurrentHashMap<>();
license.put("type", "keyword");
properties.put("license", license);
mapping.put("properties", properties);
kuzzle
  .getCollectionController()
  .update("nyc-open-data", "yellow-taxi", mapping)
  .get();