@terrajs/mono-elasticsearch
v2.1.0
Published
ElasticSearch module for Mono
Downloads
1
Readme
mono-elasticsearch
ElasticSearch module for Mono.
Installation
npm install --save @terrajs/mono-elasticsearch
Then, in your configuration file of your Mono application (example: conf/application.js
):
module.exports = {
mono: {
modules: ['@terrajs/mono-elasticsearch']
}
}
Configuration
Mono-elasticsearch will use the elasticsearch
property of your configuration (example: conf/development.js
):
module.exports = {
mono: {
elasticsearch: {
// See https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/configuration.html
host: 'localhost:9200'
}
}
}
Usage
In your modules files, you can access client
instance like this:
const { client } = require('@terrajs/mono-elasticsearch')
client.ping({
// ping usually has a 3000ms timeout
requestTimeout: 1000
}, function (error) {
if (error) {
console.trace('elasticsearch cluster is down!');
} else {
console.log('All is well');
}
});