This is a plugin to use Elasticsearch with Hemera. This plugin based on the official driver elasticsearch.
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.2.3
npm i hemera-elasticsearch --save
const hemera = new Hemera(nats)
hemera.use(equire('hemera-joi'))
hemera.use(require('hemera-elasticsearch'), {
elasticsearch: {
log: 'trace'
}
})
- .elasticsearch
The pattern is:
topic
: is the service name to publish toelasticsearch
cmd
: is the command to executesearch
data
: options see elasticsearch documentation
Example:
hemera.act(
{
topic: 'elasticsearch',
cmd: 'search',
data: {}
},
function(err, resp) {}
)
The pattern is:
topic
: is the service name to publish toelasticsearch
cmd
: is the command to executeexists
data
: options see elasticsearch documentation
Example:
hemera.act(
{
topic: 'elasticsearch',
cmd: 'exists',
data: {
index: 'my-index',
type: 'my-type',
id: 'jieu99'
}
},
function(err, resp) {}
)
The pattern is:
topic
: is the service name to publish toelasticsearch
cmd
: is the command to executecreate
data
: options see elasticsearch documentation
Example:
hemera.act(
{
topic: 'elasticsearch',
cmd: 'create',
data: {}
},
function(err, resp) {}
)
The pattern is:
topic
: is the service name to publish toelasticsearch
cmd
: is the command to executedelete
data
: options see elasticsearch documentation
Example:
hemera.act(
{
topic: 'elasticsearch',
cmd: 'delete',
data: {}
},
function(err, resp) {}
)
The pattern is:
topic
: is the service name to publish toelasticsearch
cmd
: is the command to executeupdate
data
: options see elasticsearch documentation
Example:
hemera.act(
{
topic: 'elasticsearch',
cmd: 'update',
data: {}
},
function(err, resp) {}
)
The pattern is:
topic
: is the service name to publish toelasticsearch
cmd
: is the command to executecount
data
: options see elasticsearch documentation
Example:
hemera.act(
{
topic: 'elasticsearch',
cmd: 'count',
data: {}
},
function(err, resp) {}
)
The pattern is:
topic
: is the service name to publish toelasticsearch
cmd
: is the command to executebulk
data
: options see elasticsearch documentation
Example:
hemera.act(
{
topic: 'elasticsearch',
cmd: 'bulk',
data: {}
},
function(err, resp) {}
)
The pattern is:
topic
: is the service name to publish toelasticsearch
cmd
: is the command to executerefresh
data
: options see elasticsearch documentation
Example:
hemera.act(
{
topic: 'elasticsearch',
cmd: 'refresh',
data: {}
},
function(err, resp) {}
)