title: laravel 6 + elasticsearch-php 7.6 + xampp: No alive nodes found in your cluster
body: <p>I use <a href="https://github.com/elastic/elasticsearch-php" rel="nofollow noreferrer">elasticsearch-php</a> in my laravel app with XAMPP.</p>
  
  <p><strong>Versions:</strong></p>
  
  <ul>
  <li>PHP: <strong>7.3</strong></li>
  <li>Laravel: <strong>^6.2</strong></li>
  <li>Elasticsearch: <strong>^7.6</strong></li>
  </ul>
  
  <p><code>AppServiceProvider.php</code> code where I register my custom scout driver:</p>
  
  <pre><code>public function boot()
  {
      $this-&gt;app-&gt;singleton('elasticsearch', function () {
          return ClientBuilder::create()
                  -&gt;setHosts([
                      'http://localhost/scout/public'
                  ])
                  -&gt;build();
      });
  
      resolve(EngineManager::class)-&gt;extend('elasticsearch', function () {
          return new ElasticSearchEngine(
              app('elasticsearch')
          );
      });
  }
  </code></pre>
  
  <p>My custom search engine code:</p>
  
  <pre><code>&lt;?php 
  
  namespace App\Search\Engines;
  
  use Laravel\Scout\Engines\Engine;
  use Laravel\Scout\Builder;
  use Elasticsearch\Client;
  
  class ElasticSearchEngine extends Engine
  {
      protected $client;
  
      public function __construct(Client $client)
      {
          $this-&gt;client = $client;
      }
  
      /**
       * Update the given model in the index.
       *
       * @param  \Illuminate\Database\Eloquent\Collection  $models
       * @return void
       */
      public function update($models)
      {
          $models-&gt;each(function($model) {
              $params = [
                  'index' =&gt; $model-&gt;searchableAs(),
                  'type' =&gt; $model-&gt;searchableAs(),
                  'id' =&gt; $model-&gt;id,
                  'body' =&gt; $model-&gt;toSearchableArray()
              ];
  
              $this-&gt;client-&gt;index($params);
          });
      }
  }
  </code></pre>
  
  <p>In my case when I try run command <code>php artisan scout:import App\User</code> Elasticsearch package return error with message:</p>
  
  <blockquote>
    <p>Elasticsearch\Common\Exceptions\NoNodesAvailableException  : No alive
    nodes found in your cluster</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/j8jYH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j8jYH.png" alt="enter image description here"></a></p>
  
  <p>How I can solve my problem? Maybe here problem with hosts or xampp setting?</p>