title: Faraday::ConnectionFailed Connection refused - connect(2) for "localhost" port 9200
body: <p>I have add elasticsearch in my rails app, also i have include these gems in my Gemfile:</p>
  
  <pre><code>gem "elasticsearch-rails"
  gem "elasticsearch-model"
  gem 'ngram'
  </code></pre>
  
  <p>All work fine, but every time when i restart my pc i get this error message</p>
  
  <pre><code>Faraday::ConnectionFailed Connection refused - connect(2) for "localhost" port 9200
  </code></pre>
  
  <p>Every time i need to reinstall eleasticsearch to make it work.</p>
  
  <p>I saw in other posts that for some people <code>/etc/init.d/elasticsearch restart</code>
  solve the problem but not for me. I'm using Ubuntu.</p>
  
  <p>Any suggestions?</p>
  
  <p>Gemfile.lock</p>
  
  <pre><code>GEM
    remote: https://rubygems.org/
    specs:
      actionmailer (4.2.2)
        actionpack (= 4.2.2)
        actionview (= 4.2.2)
        activejob (= 4.2.2)
        mail (~&gt; 2.5, &gt;= 2.5.4)
        rails-dom-testing (~&gt; 1.0, &gt;= 1.0.5)
      actionpack (4.2.2)
        actionview (= 4.2.2)
        activesupport (= 4.2.2)
        rack (~&gt; 1.6)
        rack-test (~&gt; 0.6.2)
        rails-dom-testing (~&gt; 1.0, &gt;= 1.0.5)
        rails-html-sanitizer (~&gt; 1.0, &gt;= 1.0.1)
      actionview (4.2.2)
        activesupport (= 4.2.2)
        builder (~&gt; 3.1)
        erubis (~&gt; 2.7.0)
        rails-dom-testing (~&gt; 1.0, &gt;= 1.0.5)
        rails-html-sanitizer (~&gt; 1.0, &gt;= 1.0.1)
      activejob (4.2.2)
        activesupport (= 4.2.2)
        globalid (&gt;= 0.3.0)
      activemodel (4.2.2)
        activesupport (= 4.2.2)
        builder (~&gt; 3.1)
      activerecord (4.2.2)
        activemodel (= 4.2.2)
        activesupport (= 4.2.2)
        arel (~&gt; 6.0)
      activesupport (4.2.2)
        i18n (~&gt; 0.7)
        json (~&gt; 1.7, &gt;= 1.7.7)
        minitest (~&gt; 5.1)
        thread_safe (~&gt; 0.3, &gt;= 0.3.4)
        tzinfo (~&gt; 1.1)
      ansi (1.5.0)
      arel (6.0.3)
      autoprefixer-rails (5.2.1.1)
        execjs
        json
      bcrypt (3.1.7)
      binding_of_caller (0.7.2)
        debug_inspector (&gt;= 0.0.1)
      bootstrap-sass (3.3.5.1)
        autoprefixer-rails (&gt;= 5.0.0.1)
        sass (&gt;= 3.3.0)
      bootstrap-will_paginate (0.0.10)
        will_paginate
      builder (3.2.2)
      byebug (5.0.0)
        columnize (= 0.9.0)
      coderay (1.1.0)
      coffee-rails (4.1.0)
        coffee-script (&gt;= 2.2.0)
        railties (&gt;= 4.0.0, &lt; 5.0)
      coffee-script (2.4.1)
        coffee-script-source
        execjs
      coffee-script-source (1.9.1.1)
      columnize (0.9.0)
      debug_inspector (0.0.2)
      elasticsearch (1.0.12)
        elasticsearch-api (= 1.0.12)
        elasticsearch-transport (= 1.0.12)
      elasticsearch-api (1.0.12)
        multi_json
      elasticsearch-model (0.1.7)
        activesupport (&gt; 3)
        elasticsearch (&gt; 0.4)
        hashie
      elasticsearch-rails (0.1.7)
      elasticsearch-transport (1.0.12)
        faraday
        multi_json
      erubis (2.7.0)
      execjs (2.5.2)
      faker (1.4.2)
        i18n (~&gt; 0.5)
      faraday (0.9.1)
        multipart-post (&gt;= 1.2, &lt; 3)
      ffi (1.9.10)
      font-awesome-rails (4.4.0.0)
        railties (&gt;= 3.2, &lt; 5.0)
      formatador (0.2.5)
      globalid (0.3.6)
        activesupport (&gt;= 4.1.0)
      guard (2.12.8)
        formatador (&gt;= 0.2.4)
        listen (&gt;= 2.7, &lt;= 4.0)
        lumberjack (~&gt; 1.0)
        nenv (~&gt; 0.1)
        notiffany (~&gt; 0.0)
        pry (&gt;= 0.9.12)
        shellany (~&gt; 0.0)
        thor (&gt;= 0.18.1)
      guard-minitest (2.3.1)
        guard (~&gt; 2.0)
        minitest (&gt;= 3.0)
      hashie (3.4.2)
      i18n (0.7.0)
      jbuilder (2.3.1)
        activesupport (&gt;= 3.0.0, &lt; 5)
        multi_json (~&gt; 1.2)
      jquery-rails (4.0.4)
        rails-dom-testing (~&gt; 1.0)
        railties (&gt;= 4.2.0)
        thor (&gt;= 0.14, &lt; 2.0)
      json (1.8.3)
      listen (3.0.1)
        rb-fsevent (&gt;= 0.9.3)
        rb-inotify (&gt;= 0.9)
      loofah (2.0.3)
        nokogiri (&gt;= 1.5.9)
      lumberjack (1.0.9)
      mail (2.6.3)
        mime-types (&gt;= 1.16, &lt; 3)
      method_source (0.8.2)
      mime-types (2.6.1)
      mini_backtrace (0.1.3)
        minitest (&gt; 1.2.0)
        rails (&gt;= 2.3.3)
      mini_portile (0.6.2)
      minitest (5.8.0)
      minitest-reporters (1.0.5)
        ansi
        builder
        minitest (&gt;= 5.0)
        ruby-progressbar
      multi_json (1.11.2)
      multipart-post (2.0.0)
      nenv (0.2.0)
      ngram (1.0.0)
      nokogiri (1.6.6.2)
        mini_portile (~&gt; 0.6.0)
      notiffany (0.0.6)
        nenv (~&gt; 0.1)
        shellany (~&gt; 0.0)
      pg (0.17.1)
      pry (0.10.1)
        coderay (~&gt; 1.1.0)
        method_source (~&gt; 0.8.1)
        slop (~&gt; 3.4)
      puma (2.11.1)
        rack (&gt;= 1.1, &lt; 2.0)
      rack (1.6.4)
      rack-test (0.6.3)
        rack (&gt;= 1.0)
      rails (4.2.2)
        actionmailer (= 4.2.2)
        actionpack (= 4.2.2)
        actionview (= 4.2.2)
        activejob (= 4.2.2)
        activemodel (= 4.2.2)
        activerecord (= 4.2.2)
        activesupport (= 4.2.2)
        bundler (&gt;= 1.3.0, &lt; 2.0)
        railties (= 4.2.2)
        sprockets-rails
      rails-deprecated_sanitizer (1.0.3)
        activesupport (&gt;= 4.2.0.alpha)
      rails-dom-testing (1.0.7)
        activesupport (&gt;= 4.2.0.beta, &lt; 5.0)
        nokogiri (~&gt; 1.6.0)
        rails-deprecated_sanitizer (&gt;= 1.0.1)
      rails-html-sanitizer (1.0.2)
        loofah (~&gt; 2.0)
      rails_12factor (0.0.2)
        rails_serve_static_assets
        rails_stdout_logging
      rails_serve_static_assets (0.0.4)
      rails_stdout_logging (0.0.4)
      railties (4.2.2)
        actionpack (= 4.2.2)
        activesupport (= 4.2.2)
        rake (&gt;= 0.8.7)
        thor (&gt;= 0.18.1, &lt; 2.0)
      rake (10.4.2)
      rb-fsevent (0.9.5)
      rb-inotify (0.9.5)
        ffi (&gt;= 0.5.0)
      rdoc (4.2.0)
      ruby-progressbar (1.7.5)
      sass (3.4.16)
      sass-rails (5.0.2)
        railties (&gt;= 4.0.0, &lt; 5.0)
        sass (~&gt; 3.1)
        sprockets (&gt;= 2.8, &lt; 4.0)
        sprockets-rails (&gt;= 2.0, &lt; 4.0)
        tilt (~&gt; 1.1)
      sdoc (0.4.1)
        json (~&gt; 1.7, &gt;= 1.7.7)
        rdoc (~&gt; 4.0)
      shellany (0.0.1)
      slop (3.6.0)
      spring (1.3.6)
      sprockets (3.3.1)
        rack (~&gt; 1.0)
      sprockets-rails (2.3.2)
        actionpack (&gt;= 3.0)
        activesupport (&gt;= 3.0)
        sprockets (&gt;= 2.8, &lt; 4.0)
      sqlite3 (1.3.10)
      thor (0.19.1)
      thread_safe (0.3.5)
      tilt (1.4.1)
      turbolinks (2.5.3)
        coffee-rails
      tzinfo (1.2.2)
        thread_safe (~&gt; 0.1)
      uglifier (2.5.3)
        execjs (&gt;= 0.3.0)
        json (&gt;= 1.8.0)
      web-console (2.2.1)
        activemodel (&gt;= 4.0)
        binding_of_caller (&gt;= 0.7.2)
        railties (&gt;= 4.0)
        sprockets-rails (&gt;= 2.0, &lt; 4.0)
      will_paginate (3.0.7)
  
  PLATFORMS
    ruby
  
  DEPENDENCIES
    autoprefixer-rails
    bcrypt (~&gt; 3.1.7)
    bootstrap-sass (~&gt; 3.3.1)
    bootstrap-will_paginate (= 0.0.10)
    byebug
    coffee-rails (~&gt; 4.1.0)
    elasticsearch-model
    elasticsearch-rails
    faker (= 1.4.2)
    font-awesome-rails
    guard-minitest (= 2.3.1)
    jbuilder
    jquery-rails
    mini_backtrace (= 0.1.3)
    minitest-reporters (= 1.0.5)
    ngram
    pg (= 0.17.1)
    puma (= 2.11.1)
    rails (= 4.2.2)
    rails_12factor (= 0.0.2)
    sass-rails (= 5.0.2)
    sdoc (~&gt; 0.4.0)
    spring
    sqlite3
    turbolinks
    uglifier (= 2.5.3)
    web-console (~&gt; 2.0)
    will_paginate (= 3.0.7)
  
  BUNDLED WITH
     1.10.6
  </code></pre>