update #
Available since Kuzzle 2.1.0
You can define the collection dynamic mapping policy by setting the dynamic
field to the desired value.
You can define collection additional metadata within the _meta
root field.
public CompletableFuture<Void> update(
final String index,
final String collection,
final ConcurrentHashMap<String, Object> mapping)
Arguments | Type | Description |
---|---|---|
index | String | Index name |
collection | String | Collection name |
mapping | ConcurrentHashMap<String, Object> | Describes the collection mapping |
mapping #
A ConcurrentHashMap<String, Object>
representing the collection data mapping.
It must have a root field properties
that contain the mapping definition:
{
mappings={
dynamic="[true|false|strict]",
_meta={
field="value"
},
properties={
field1={ type='text' },
field2={
properties={
nestedField={ type='keyword' }
}
}
}
}
};
More information about database mappings here.
Returns #
Returns a CompletableFuture<Void>
.
Usage #
ConcurrentHashMap<String, Object> mapping = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> properties = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> license = new ConcurrentHashMap<>();
license.put("type", "keyword");
properties.put("license", license);
mapping.put("properties", properties);
kuzzle
.getCollectionController()
.update("nyc-open-data", "yellow-taxi", mapping)
.get();
Edit this page on Github(opens new window)