title: Error: connect ECONNREFUSED 127.0.0.1:9200 ElasticSearch Firebase
body: <p>From the firebase elastic search project flashlight: <a href="https://github.com/firebase/flashlight.git" rel="nofollow">https://github.com/firebase/flashlight.git</a></p>
  
  <p>I imported data from example/seed/data.json into my <a href="https://flashlighttest.firebaseio.com" rel="nofollow">https://flashlighttest.firebaseio.com</a></p>
  
  <p>I run this in root: </p>
  
  <pre><code>FB_NAME="flashlighttest" node app.js
  </code></pre>
  
  <p>I got this error.</p>
  
  <pre><code>failed to index firebase/user/bruce: Error: connect ECONNREFUSED 127.0.0.1:9200
  failed to index firebase/user/chan: Error: connect ECONNREFUSED 127.0.0.1:9200
  failed to index firebase/user/chuck: Error: connect ECONNREFUSED 127.0.0.1:9200
  failed to index firebase/user/kaiso: Error: connect ECONNREFUSED 127.0.0.1:9200
  failed to index firebase/user/kato: Error: connect ECONNREFUSED 127.0.0.1:9200
  failed to index firebase/user/musashi: Error: connect ECONNREFUSED 127.0.0.1:9200
  { Error: connect ECONNREFUSED 127.0.0.1:9200
      at Object.exports._errnoException (util.js:1007:11)
      at exports._exceptionWithHostPort (util.js:1030:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1080:14)
    code: 'ECONNREFUSED',
    errno: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 9200 }
  { Error: connect ECONNREFUSED 127.0.0.1:9200
      at Object.exports._errnoException (util.js:1007:11)
      at exports._exceptionWithHostPort (util.js:1030:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1080:14)
    code: 'ECONNREFUSED',
    errno: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 9200 }
  { Error: connect ECONNREFUSED 127.0.0.1:9200
      at Object.exports._errnoException (util.js:1007:11)
      at exports._exceptionWithHostPort (util.js:1030:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1080:14)
    code: 'ECONNREFUSED',
    errno: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 9200 }
  </code></pre>
  
  <p>After, i run <code>serve</code> in the example folder and open <a href="http://localhost:3000/" rel="nofollow">http://localhost:3000/</a>. Then, any words that I searched, I got 0 result with this error.</p>
  
  <pre><code>{
    "error": {
      "address": "127.0.0.1",
      "code": "ECONNREFUSED",
      "errno": "ECONNREFUSED",
      "port": 9200,
      "syscall": "connect"
    },
    "total": 0
  }
  </code></pre>
  
  <p>I know that this error happens in lib/PathMonitor.js the _childAdded function.</p>
  
  <pre><code>_childAdded: function(key, data) {
        var name = nameFor(this, key);
        this.esc.index(this.index, this.type, data, key)
           .on('data', function(data) {
              console.log('indexed'.green, name);
           })
           .on('error', function(err) {
              console.error('failed to index %s: %s'.red, name, err);
           })
           .exec();
     },
  </code></pre>
  
  <p>Can someone tell me of what went wrong?</p>
  
  <p>Thanks</p>