SDK
SDK Java v3.x
2

# updateSpecifications

The updateSpecifications method allows you to create or update the validation specifications for a collection.

When the validation specification is not formatted correctly, a detailed error message is returned to help you to debug.


Copied to clipboard!
public CompletableFuture<ConcurrentHashMap<String, Object>> updateSpecifications(
      final String index,
      final String collection,
      final ConcurrentHashMap<String, Object> specifications)

Arguments Type Description
index
String
Index name
collection
String
Collection name
specifications
ConcurrentHashMap<String, Object>
Specifications to update

# specifications

A ConcurrentHashMap<String, Object> representing the specifications.

It must follow the Specification Structure.

# Returns

Returns a ConcurrentHashMap<String, Object> containing the specifications.

# Usage

Copied to clipboard!
ConcurrentHashMap<String, Object> specifications = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> fields = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> license = new ConcurrentHashMap<>();
specifications.put("strict", false);
license.put("mandatory", true);
license.put("type", "string");
fields.put("license", license);
specifications.put("fields", fields);
ConcurrentHashMap<String, Object> result = kuzzle
  .getCollectionController()
  .updateSpecifications("nyc-open-data", "yellow-taxi", specifications)
  .get();
/*
  {
    strict=false,
    fields={
      license={
        mandatory=true,
        type="string"
      }
      }
    }
 */