UpdateMapping #
Update the collection mapping. Mapping allow you to exploit the full capabilities of our persistent data storage layer, ElasticSearch (opens new window) (check here the mapping capabilities of ElasticSearch (opens new window)).
Arguments #
UpdateMapping(index string, collection string, mapping json.RawMessage, options types.QueryOptions) error
Arguments | Type | Description |
---|---|---|
index | string | Index name |
collection | string | Collection name |
mapping | json.RawMessage | Collection data mapping in JSON format |
options | QueryOptions | Query options |
mapping #
An string containing the JSON representation of the collection data mapping.
The mapping must have a root field properties
that contain the mapping definition:
{
"properties": {
"field1": { "type": "text" },
"field2": {
"properties": {
"nestedField": { "type": "keyword" }
}
}
}
}
More informations about database mappings here.
options #
Additional query options
Property | Type | Description | Default |
---|---|---|---|
queuable | bool | Make this request queuable or not | true |
Return #
Return an error if something went wrong.
Usage #
mapping := json.RawMessage(`{"properties":{"plate": {"type": "keyword"}}}`)
err := kuzzle.Collection.UpdateMapping("nyc-open-data", "yellow-taxi", mapping, nil)
if err != nil {
log.Fatal(err)
} else {
fmt.Println("Success")
}
Edit this page on Github (opens new window)