laravel-scout-elasticsearch icon indicating copy to clipboard operation
laravel-scout-elasticsearch copied to clipboard

[BUG] php artisan scout:import not importing

Open bastienuh opened this issue 2 years ago • 1 comments

Describe the bug I have an ElasticSearchServiceProvider in my app/Providers directory.

The client build is made as follow:

$client = ClientBuilder::create()
    ->setHosts([ 'http://'.env('ELASTICSEARCH_HOST').':'.env('ELASTICSEARCH_PORT') ])
    ->setBasicAuthentication(env('ELASTICSEARCH_USER'), env('ELASTICSEARCH_PASS'))
    ->build();

If I add the following code to my provider:

$response = $client->info();

dd($response->getStatusCode());

I get 200, so I think the elascticSearch server is totally OK.

But when I use php artisan scout:import "App\Models\MyModel" in my console, I have the following error:

In SimpleNodePool.php line 77:
  No alive nodes. All the 1 nodes seem to be down.

Do you know why? Am I missing something?

Thanks for your help, again.

bastienuh avatar Jun 13 '22 16:06 bastienuh

Could you share your elasticsearch provider?

matchish avatar Jun 14 '22 15:06 matchish

i am having same issue.

i can curl and get a repsonse but thorugh php it does not work

% curl https://localhost:8081/_search -k
{"took":9,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":1.0,"hits":[{"_index":".kibana_1","_type":"_doc","_id":"config:7.10.2","_score":1.0,"_source":{"config":{"buildNum":36156},"type":"config","references":[],"migrationVersion":{"config":"7.9.0"},"updated_at":"2022-09-30T08:31:02.869Z"}}]}}% 
  Elasticsearch\Common\Exceptions\NoNodesAvailableException 

  No alive nodes found in your cluster

  at vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php:64
     60▕                 return $connection;
     61▕             }
     62▕         }
     63▕ 
  ➜  64▕         throw new NoNodesAvailableException("No alive nodes found in your cluster");
     65▕     }
     66▕ 
     67▕     public function scheduleCheck(): void
     68▕     {

      +53 vendor frames 
  54  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

shorif2000 avatar Sep 30 '22 16:09 shorif2000

Did you add your Provider to the provider's list on the config file?

hkulekci avatar Sep 30 '22 22:09 hkulekci

it was problem with https. I had to switch to http

shorif2000 avatar Nov 15 '22 12:11 shorif2000