# Node-RED + Elasticsearch

**URL:** <https://discuss.elastic.co/t/node-red-elasticsearch/140345>\
**Category:** Elasticsearch\
**Created:** [July 17, 2018, 2:29pm UTC](https://discuss.elastic.co/t/node-red-elasticsearch/140345 "2018-07-17T14:29:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_Prange](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolas_prange/32/33390_2.png) [@Nicolas\_Prange](https://discuss.elastic.co/u/Nicolas_Prange)\
**Post date:** [July 17, 2018, 2:29pm UTC](https://discuss.elastic.co/t/node-red-elasticsearch/140345/1 "2018-07-17T14:29:47Z")

</div>

Hi,  
I am trying to send data from Node-RED to Elasticsearch, but I receive the following error:

Elasticsearch ERROR: 2018-07-17T14:30:15Z  
Error: Request error, retrying  
HEAD [http://localhost/twitterr/tweets/1](http://localhost/twitterr/tweets/1) =\> connect ECONNREFUSED 127.0.0.1:80  
at Log.error (/home/workdb/.node-red/node\_modules/elasticsearch/src/lib/log.js:225:56)  
at checkRespForFailure (/home/workdb/.node-red/node\_modules/elasticsearch/src/lib/transport.js:258:18)  
at HttpConnector. (/home/workdb/.node-red/node\_modules/elasticsearch/src/lib/connectors/http.js:157:7)  
at ClientRequest.bound (/home/workdb/.node-red/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)  
at emitOne (events.js:116:13)  
at ClientRequest.emit (events.js:211:7)  
at Socket.socketErrorListener (\_http\_client.js:387:9)  
at emitOne (events.js:116:13)  
at Socket.emit (events.js:211:7)  
at emitErrorNT (internal/streams/destroy.js:64:8)  
at \_combinedTickCallback (internal/process/next\_tick.js:138:11)  
at process.\_tickCallback (internal/process/next\_tick.js:180:9)

Elasticsearch WARNING: 2018-07-17T14:30:15Z  
Unable to revive connection: [http://localhost/](http://localhost/)

Elasticsearch WARNING: 2018-07-17T14:30:15Z  
No living connections

17 Jul 11:30:15 - [error] [es-exists:cee9ae59.c86a2] Error: No Living connection

Anyone knows how to fix this?

---

<div class="post-metadata">

**Author:** ![tdasch](https://avatars.discourse-cdn.com/v4/letter/t/58f4c7/32.png) [@tdasch](https://discuss.elastic.co/u/tdasch)\
**Post date:** [July 17, 2018, 5:02pm UTC](https://discuss.elastic.co/t/node-red-elasticsearch/140345/2 "2018-07-17T17:02:10Z")

</div>

Hey Nicolas,

Are you sure your Elasticsearch node is up and running? You can curl it?

---

<div class="post-metadata">

**Author:** ![Nicolas\_Prange](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolas_prange/32/33390_2.png) [@Nicolas\_Prange](https://discuss.elastic.co/u/Nicolas_Prange)\
**Post date:** [July 17, 2018, 6:10pm UTC](https://discuss.elastic.co/t/node-red-elasticsearch/140345/3 "2018-07-17T18:10:59Z")

</div>

Hey Thomas, thank you for the reply!  
I made some tests in the terminal using node.js as elasticsearch guide ([https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/quick-start.html](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/quick-start.html)) tells, and everything goes well.  
Now I'm trying to connect Node-RED to Elasticsearch for send data from a function in Node-RED to Elasticsearch for use this data in Kibana.  
I am using some libraries from Node-RED to connect with ES, but I thing that I am missing something.  
Sometime after some changes, I received this error:  
"ReferenceError: documentType is not defined", and I been wondering, is it an error in Node-RED or ES? 😕  
 ![9ad96ab26258bbca4cadc40a1348be0f314c7af9_1_690x378](https://us1.discourse-cdn.com/elastic/original/3X/4/6/469d6b2bea64b911526962a26d43d25b407bf330.png) ![6379740a34145847b61f27d961bbd5b6cb555c61_1_690x378](https://us1.discourse-cdn.com/elastic/original/3X/2/b/2ba105819d88768f727ac1708fcc2588b7d40cb0.png) ![58c798147d43d9309ff7688f1cb4744710836667_1_690x378](https://us1.discourse-cdn.com/elastic/original/3X/e/0/e0b0e17592f324ced4435c80d7f9318644a3fb6a.png)

---

<div class="post-metadata">

**Author:** ![tdasch](https://avatars.discourse-cdn.com/v4/letter/t/58f4c7/32.png) [@tdasch](https://discuss.elastic.co/u/tdasch)\
**Post date:** [July 17, 2018, 7:02pm UTC](https://discuss.elastic.co/t/node-red-elasticsearch/140345/4 "2018-07-17T19:02:34Z")

</div>

Nicolas,

Node-RED is beyond my scope, so please bear with me as I attempt humble troubleshooting. FYI, the pictures are really hard to see unforunately. I'm glad to hear things are up and running now and you have connectivity! I've [found this flow](https://flows.nodered.org/node/node-red-contrib-elasticsearch-jd), which may be the very one you are using, if not it might be worth a quick look. Based on the error it sounds like you're not defining the document type. Referencing that link I provided, it looks like regardless of the usage, create/delete/search/etc..., `msg.documentType` should be set in an incoming message unless it was configured in the node.

---

<div class="post-metadata">

**Author:** ![Nicolas\_Prange](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolas_prange/32/33390_2.png) [@Nicolas\_Prange](https://discuss.elastic.co/u/Nicolas_Prange)\
**Post date:** [July 17, 2018, 7:07pm UTC](https://discuss.elastic.co/t/node-red-elasticsearch/140345/5 "2018-07-17T19:07:18Z")

</div>

haha, no problems.  
I got it and I will try.

After some changes, I get the following error:  
"RangeError: Maximum call stack size exceeded"

ohhh lord o/

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 14, 2018, 7:07pm UTC](https://discuss.elastic.co/t/node-red-elasticsearch/140345/6 "2018-08-14T19:07:24Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
