This module provides an elasticsearch
-based implementation of ModelSource
for the Model
module. This source allows the Model
module to read, write and query against elasticserch
. In development mode, the ModelSource
will also modify the elasticsearch
schema in real time to minimize impact to development.
All that is needed to use the ModelSource
is to register it with the Dependency Injection
module.
export class Init {
@InjectableFactory()
static getModelSource(conf: ModelElasticsearchConfig): ModelSource {
return new ModelElasticsearchSource(conf);
}
}
where the ModelElasticsearchConfig
is defined by:
@Config('model.elasticsearch')
export class ModelElasticsearchConfig {
hosts = ['127.0.0.1'];
port = 9200;
options = {};
namespace = 'app';
}
and can be overridden via environment variables or config files, as defined in Config
.
NOTE During testing, the source will automatically spin up an elasticsearch
server via a docker
container if you are not already running the service.