SDK
SDK Jvm v1.x
2

update #

Available since Kuzzle 2.1.0

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

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

Available since Kuzzle 2.2.0

You can also provide Elasticsearch index settings when creating a new collection.


:::: tabs ::: tab Java

Arguments #

Copied to clipboard!
public CompletableFuture<Map<String, Object>> update(
      final String index,
      final String collection,
      final Map<String, Object> definition)


Arguments Type Description
index
String
Index name
collection
String
Collection name
definition
Map<String, Object>
Describes the collection mappings and the ES index settings

definition #

An object containing:

Copied to clipboard!
{
  "mappings"={
    "properties"={
      "field1"={ "type"="text" },
      "field2"={
        "properties"={
          "nestedField"={ "type": "keyword" }
        }
      }
    }    
  },
  "settings"={
    // index settings (e.g. analyzers)
  }
};

Usage #

Copied to clipboard!
Map<String, Object> definition = new HashMap<>();
Map<String, Object> properties = new HashMap<>();
Map<String, Object> _meta = new HashMap<>();
Map<String, Object> plate = new HashMap<>();
plate.put("type", "keyword");
_meta.put("area", "Panipokhari");
properties.put("plate", plate);
definition.put("dynamic", false);
definition.put("_meta", _meta);
definition.put("properties", properties);
kuzzle
  .getCollectionController()
  .update("nyc-open-data", "yellow-taxi", definition)
  .get();
System.out.println("Success");

:::

::::