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)
Arguments | Type | Description |
---|---|---|
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
Property | Type | Description | Default |
---|---|---|---|
queuable | bool | Make this request queuable or not | true |
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")
}
Edit this page on Github(opens new window)