updateMapping #
Updates the collection mappings.
Arguments #
public async Task UpdateMappingAsync(
string index,
string collection,
JObject mappings);
Argument | Type | Description |
---|---|---|
index | string | Index name |
collection | string | Collection name |
mappings | JObject | JObject representing the collection data mapping |
mapping #
A JObject representing the collection data mapping.
dynamic
: dynamic mapping policy for new fields. Allowed values:true
(default),false
,strict
_meta
: collection additional metadata stored next to the collectionproperties
: object describing the data mapping to associate to the new collection, using [Elasticsearch types definitions format](object describing the data mapping to associate to the new collection, using)
{
"dynamic": "[true|false|strict]",
"_meta": {
"field": "value"
},
"properties": {
"field1": {
"type": "integer"
},
"field2": {
"type": "keyword"
},
"field3": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
}
More information about database mappings here.
Usage #
try {
JObject mappings = JObject.Parse(@"{
properties: {
plate: {
type: 'keyword'
}
}
}");
await kuzzle.Collection.UpdateMappingAsync("nyc-open-data", "yellow-taxi", mappings);
Console.WriteLine("Mapping successfully updated");
} catch (Exception e) {
Console.WriteLine(e);
}
Edit this page on Github(opens new window)