Skip to content
This repository was archived by the owner on Jul 9, 2018. It is now read-only.

Latest commit

 

History

History
31 lines (24 loc) · 1.22 KB

README.md

File metadata and controls

31 lines (24 loc) · 1.22 KB

travetto: Model-Elasticsearch

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.