# ElasticSearch.js some how hangs?

**URL:** <https://discuss.elastic.co/t/elasticsearch-js-some-how-hangs/20930>\
**Category:** Elasticsearch\
**Created:** [November 25, 2014, 8:30am UTC](https://discuss.elastic.co/t/elasticsearch-js-some-how-hangs/20930 "2014-11-25T08:30:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_5](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@James\_5](https://discuss.elastic.co/u/James_5)\
**Post date:** [November 25, 2014, 8:30am UTC](https://discuss.elastic.co/t/elasticsearch-js-some-how-hangs/20930/1 "2014-11-25T08:30:32Z")

</div>

Hi all,

I'm writing a web crawler in Node.js and indexing with ElasticSearch.  
However, I've ran into a problem where the code hangs at the indexing  
function.

Here's how the client is initialised:

```
var es_client = new elasticsearch.Client({
    host: "localhost:9200",
    log: ['error', 'trace'],
    keepAlive: true,
    sniffOnConnectionFault: true,
    //sniffInterval: 6000,
    sniffOnStart: true,
    maxKeepAliveTime: 600000
});

```

And here's the indexing API call:

```
es_client.index({
  index: seedURL,
  type: 'post',
  id: generate_md5(username + "\n" + post_title + "\n" + post_content),
  body: {
    thread_md5 : thread_md5,
    thread_title : thread_title,
    thread_url : post_list_page_url,
    post_title: post_title,
    post_order : post_order,
    post_content: post_content,
    timestamp: timestamp,
    username: username,
    
  }
}).then(
    function (resp) {
        console.log("Elasticsearch response to indexing " + post_title 

```

- "...");  
console.log(resp);  
},  
function (err) {  
console.log("[ERROR] An error occurred whilst indexing: " +  
post\_title + "...");  
console.log(err.message);  
}  
);

I have been testing the crawler script by commenting out the call to  
indexing and it finishes the crawl no problem. This showed that the problem  
somehow lies with ElasticSearch.

I have also had a look at the ElasticSearch logs and no errors were raised.

Lastly - and this could be the best hint yet - is that the number of  
documents successfully indexed at every trial run hangs at _exactly_ 277  
documents.

Thoughts?

Cheers,

James

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/47d54f06-1ed8-4170-a019-31e88009fb06%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/47d54f06-1ed8-4170-a019-31e88009fb06%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:47am UTC](https://discuss.elastic.co/t/elasticsearch-js-some-how-hangs/20930/2 "2017-07-06T00:47:50Z")

</div>


