4.2.0 • Published 6 years ago

hemera-elasticsearch v4.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

Hemera-elasticsearch package

Build Status npm styled with prettier

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.3

Install

npm i hemera-elasticsearch --save

Usage

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 to elasticsearch
  • cmd: is the command to execute search
  • data: 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 to elasticsearch
  • cmd: is the command to execute exists
  • data: 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 to elasticsearch
  • cmd: is the command to execute create
  • data: 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 to elasticsearch
  • cmd: is the command to execute delete
  • data: 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 to elasticsearch
  • cmd: is the command to execute update
  • data: 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 to elasticsearch
  • cmd: is the command to execute count
  • data: options see elasticsearch documentation

Example:

hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'count',
    data: {}
  },
  function(err, resp) {}
)

bulk

The pattern is:

Example:

hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'bulk',
    data: {}
  },
  function(err, resp) {}
)

refresh

The pattern is:

  • topic: is the service name to publish to elasticsearch
  • cmd: is the command to execute refresh
  • data: options see elasticsearch documentation

Example:

hemera.act(
  {
    topic: 'elasticsearch',
    cmd: 'refresh',
    data: {}
  },
  function(err, resp) {}
)
4.2.0

6 years ago

4.1.0

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.34

7 years ago

1.0.33

7 years ago

1.0.32

7 years ago

1.0.31

7 years ago

1.0.30

7 years ago

1.0.29

7 years ago

1.0.28

7 years ago

1.0.27

7 years ago

1.0.26

7 years ago

1.0.25

7 years ago

1.0.24

7 years ago

1.0.23

7 years ago

1.0.22

7 years ago

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago