SDK
SDK Golang 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.

UpdateSpecifications #

The updateSpecifications method allows you to create or update the validation specifications for one or more index/collection pairs.

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

Arguments #

UpdateSpecifications(index string, collection string, specifications json.RawMessage, options types.QueryOptions) (json.RawMessage, error)
ArgumentsTypeDescription
index
string
Index name
collection
string
Collection name
specifications
json.RawMessage
Specifications in JSON format
options
QueryOptions
Query options

specifications #

A JSON representation of the specifications.

The JSON must follow the Specification Structure:

{
  "strict": "<boolean>",
  "fields": {
    // ... specification for each field
  }
}

options #

Additional query options

PropertyTypeDescriptionDefault
queuable
bool
Make this request queuable or nottrue

Return #

Return a JSON representation of the specifications. Return an error with a global description of errors.

Usage #

specifications := json.RawMessage(`{ "strict": false, "fields": { "license": { "mandatory": true, "type": "string" } } }`)
response, err := kuzzle.Collection.UpdateSpecifications("nyc-open-data", "yellow-taxi", specifications, nil)
if err != nil {
  log.Fatal(err)
} else if response != nil {
  fmt.Println("Success")
}