hemera-elasticsearch v4.2.0
Hemera-elasticsearch package
This is a plugin to use Elasticsearch with Hemera. This plugin based on the official driver elasticsearch.
Start elasticsearch via docker
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.2.3Install
npm i hemera-elasticsearch --saveUsage
const hemera = new Hemera(nats)
hemera.use(hemeraElasticsearch, {
  elasticsearch: {
    log: 'trace'
  }
})Plugin decorators
- .elasticsearch
 
Interface
search
The pattern is:
topic: is the service name to publish toelasticsearchcmd: is the command to executesearchdata: options see elasticsearch documentation
Example:
hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'search',
    data: {}
  },
  function(err, resp) {}
)exists
The pattern is:
topic: is the service name to publish toelasticsearchcmd: is the command to executeexistsdata: options see elasticsearch documentation
Example:
hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'exists',
    data: {
      index: 'my-index',
      type: 'my-type',
      id: 'jieu99'
    }
  },
  function(err, resp) {}
)create
The pattern is:
topic: is the service name to publish toelasticsearchcmd: is the command to executecreatedata: options see elasticsearch documentation
Example:
hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'create',
    data: {}
  },
  function(err, resp) {}
)delete
The pattern is:
topic: is the service name to publish toelasticsearchcmd: is the command to executedeletedata: options see elasticsearch documentation
Example:
hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'delete',
    data: {}
  },
  function(err, resp) {}
)update
The pattern is:
topic: is the service name to publish toelasticsearchcmd: is the command to executeupdatedata: options see elasticsearch documentation
Example:
hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'update',
    data: {}
  },
  function(err, resp) {}
)count
The pattern is:
topic: is the service name to publish toelasticsearchcmd: is the command to executecountdata: options see elasticsearch documentation
Example:
hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'count',
    data: {}
  },
  function(err, resp) {}
)bulk
The pattern is:
topic: is the service name to publish toelasticsearchcmd: is the command to executebulkdata: options see elasticsearch documentation
Example:
hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'bulk',
    data: {}
  },
  function(err, resp) {}
)refresh
The pattern is:
topic: is the service name to publish toelasticsearchcmd: is the command to executerefreshdata: options see elasticsearch documentation
Example:
hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'refresh',
    data: {}
  },
  function(err, resp) {}
)8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago