title: Creating an index with ElasticSearch javascript client, promise does not return
body: <p>Here is something that's been driving me crazy since an hour now. I'm working on a side project which involves accessing ElasticSearch with Javascript. As a part of the tests, I wanted to create an index. Here is a very simple snippet that, in my mind, should do this, and print the messages returned from the ElasticSearch server:</p>
  
  <pre><code>var es = require('elasticsearch');
  
  var es_client = new es.Client({host: "localhost:9200"});
  var breaker = Math.floor((Math.random() * 100) + 1);
  
  var create_promise = es_client.indices.create({index: "test-index-" + breaker});
  create_promise.then(function(x) {
      console.log(x);
  }, function(err) { console.log(err);});
  </code></pre>
  
  <p>What happens when I go to a directory, run <code>npm install elasticsearch</code>, and then run this code with NodeJS, is that the request is made, but the promise does not return due to some reason. I would expect this code to run to the end, and finish once the response from ES server comes back. Instead, the process just hangs. Any ideas why?</p>
  
  <p>I know that an index can be created just by adding a document to it, but this weird behavior just bugged me, and I couldn't figure out the reason or the sense behind it.</p>