node-red-contrib-elasticsearch-jd 0.0.6
A set of Node-RED nodes for Elasticsearch including search, get, exists, create, update and delete.
node-red-contrib-elasticsearch
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-elasticsearch-jd
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 usemsg.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 documentmsg.documentIndex
- the index to usemsg.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 documentmsg.documentIndex
- the index to usemsg.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 documentmsg.documentIndex
- the index to usemsg.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 usemsg.documentType
- the type to usemsg.query
- the query string to usemsg.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 documentmsg.documentIndex
- the index to usemsg.documentType
- the type to use
See the Elasticsearch documentation for more information.