...
Code Block |
---|
|
PUT admin/create/<storage-unit-name> |
Response
If the storage unit was created successfully, a 200 response code with an OK message is returned.
...
Code Block |
---|
|
{"message": "STORAGE_UNIT_DOESNT_EXIST"} |
List Storage Units
Lists all available storage units with the option of returning content and transaction statistics.
...
Code Block |
---|
|
[
{"name": "Management"},
{"name": "Management10"},
{"name": "Management4"},
{"name": "Management5"},
{"name": "testStorageUnit"}
] |
A 200 response code with the list of storage unit names and statistics is return when using the withStats parameter.
...
Code Block |
---|
|
{
"name": "Management5",
"records": 32,
"transactions": 32,
"latestTransactionTime": "2015-11-12T20:13:13.737Z",
"latestTransactionNum": "5644f2d997cc11144081d14f"
} |
...
If the storage unit doesn't exist, a 400 response code with a STORAGE_UNIT_DOESNT_EXIST message is returned.
...
Code Block |
---|
|
{"message": "STORAGE_UNIT_DOESNT_EXIST"} |
...
Configure Storage Unit
A storage unit has a set of events that are triggered during different actions performed on the storage unit. There are two different types of events: per document events and general events.
...
Code Block |
---|
|
exports.PostAdd = function(key, content, context, settings){
initialize(settings);
if (context.isBatch !== undefined && context.isBatch === true){
if (content){
context.batchArray.push({ index: { _index: index, _type: type, _id: key }});
context.batchArray.push(content);
}
return content;
} else {
client.index({
index: index,
type: type,
id: key,
body: content
}, function (err, resp) {
if (err) console.log('Error publishing' + JSON.stringify(err));
if (resp) console.log('Publish successful');
return content;
});
}
}; |
General events receive two parameters: context: A Javascript Object with configuration variables and access to utility functions. settings: List of available configuration properties for the module.
Code Block |
---|
|
exports.BatchStart = function(context, settings){
initialize(settings);
if (context.batchArray === undefined){
context.batchArray =[];
}
}; |
The configure API call configures content processing modules and module settings for a storage unit. Content processing modules are configured per scope. A default list of modules can be configured for scopes that are not explicitly defined. Each module can define it's own collection of settings. When executing the events for each module, these will be executed in the order in which they appear in the configuration array.
Storage unit configuration consists of lists of modules for each scope and general settings. Each module may contain specific settings, as well.
Code Block |
---|
|
{
"modules" : {
"connector": [
{
"module" : "AspireFieldMapping"
},
{
"settings" : {
"elasticsearch-index" : "aspiredocs",
"elasticsearch-type" : "aspiredoc"
},
"module" : "ESPublisher"
}
],
"index" : [
{
"module" : "FieldMapping"
},
{
"settings" : {
"elasticsearch-index" : "researchdocs",
"elasticsearch-type" : "researchdoc"
},
"module" : "ESPublisher"
}
],
"research" : [
{
"module" : "NormalizeCategory"
}
]
},
"settings" : {
"elasticsearch-port" : 9200,
"elasticsearch-server" : "localhost"
}
} |
...
The storage unit PUT/POST set content processing modules request requires the name of the storage unit in the URL and receives a JSON in the body with the content processing modules configuration. This will replace any previous stored configuration for the storage unit.
Code Block |
---|
|
POST admin/setContentProcessingModules/<storage-unit-name> |
...
Code Block |
---|
|
{"message":"OK"} |
...
Enable Content Processing
...
Code Block |
---|
|
{"message":"OK"} |
Enable Content Compression
...
Code Block |
---|
|
POST admin/enableContentCompression/<storage-unit-name>/true |
Disable
Code Block |
---|
|
POST admin/enableContentCompression/<storage-unit-name>/false |
...
Response
If the operation is successful, a 200 response code and an OK message are returned.
Code Block |
---|
|
{"message":"OK"} |
...
Enable Reprocessing Queue
...
Code Block |
---|
|
POST admin/enableContentCompression/<storage-unit-name>/true |
Disable
Code Block |
---|
|
POST admin/enableContentCompression/<storage-unit-name>/false |
Response
If the operation is successful, a 200 response code and an OK message are returned.
Code Block |
---|
|
{"message":"OK"} |
Get Configuration
Get the current storage unit configuration (content processing).
...
Code Block |
---|
|
POST admin/getConfiguration/<storage-unit-name> |
...
Response
If the operation is successful, a 200 response code and the storage unit JSON configuration.
...