Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 5.04 KB

README.md

File metadata and controls

66 lines (44 loc) · 5.04 KB

node-red-contrib-elasticsearch3

A Fork from @jeffdonthemic node-red-contrib-elasticsearch-jd

Changelog

  • Now module is working :-D
  • Supports multiple server separated by spaces and with port(Example http://localhost:9200)
  • Search now appear Config server
  • Search now support msg.body with entire request body

Special thanks to @jeffdonthemic, and their good work, less than 30 minutes is needed to make the module works.

...And of course thanking the @knolleary by the great nodered project.

A set of Node-RED nodes for Elasticsearch including search, get, exists, create, update and delete.

Install


Run the following command in the root directory of your Node-RED install

npm install node-red-contrib-elasticsearch3

Usage

Create

Adds a document in a specific index, making it searchable.

The msg.payload will be used for the body of the document. The index and type can be configured in the node, however if left blank, the following should be set in an incoming message:

  • msg.documentIndex - the index to use
  • msg.documentType - the type to use

If msg.documentId is null, then Elasticsearch will generate an ID for the document.

See the Elasticsearch documentation for more information.

Delete

Delete a document from a specific index based on its id.

The id, index and type can be configured in the node, however if left blank, the following should be set in an incoming message:

  • msg.documentId - the id of the document
  • msg.documentIndex - the index to use
  • msg.documentType - the type to use

See the Elasticsearch documentation for more information.

Exists

Returns a boolean indicating whether or not a given document exists by id.

The boolean property msg.exists is added to the message and is emitted out of the node with the original payload.

The id, index and type can be configured in the node, however if left blank, the following should be set in an incoming message:

  • msg.documentId - the id of the document
  • msg.documentIndex - the index to use
  • msg.documentType - the type to use

See the Elasticsearch documentation for more information.

Get

Get a document from an index based on its id.

The id, index and type can be configured in the node, however if left blank, the following should be set in an incoming message:

  • msg.documentId - the id of the document
  • msg.documentIndex - the index to use
  • msg.documentType - the type to use

An error is thrown if the matching document is not found.

See the Elasticsearch documentation for more information.

Search

Search with a simple query string query.

The index, type, query, includeFields, sort and max results returned can be configured in the node, however if left blank, the following should be set in an incoming message:

  • msg.documentIndex - the index to use
  • msg.documentType - the type to use
  • msg.query - the query string to use
  • msg.body - Full body JSON to send, overwrites query
  • msg.includeFields - A comma separated list of fields to extract and return from the _source field. If left blank, returns all fields.
  • msg.sort - the direction to sort the results. Enter a comma-separated list of field:direction pairs. Leave blank to sort by score.
  • msg.maxResults - the maximum number of results to be returned from the query. Default is 10.

See the Elasticsearch documentation for more information.

Update

Update parts of a document.

The msg.payload will be used for the body to update the document. The id, index and type can be configured in the node, however if left blank, the following should be set in an incoming message:

  • msg.documentId - the id of the document
  • msg.documentIndex - the index to use
  • msg.documentType - the type to use

See the Elasticsearch documentation for more information.