I use elasticsearch-php in my laravel app with XAMPP.
Versions:
AppServiceProvider.php code where I register my custom scout driver:
public function boot()
{
    $this->app->singleton('elasticsearch', function () {
        return ClientBuilder::create()
                ->setHosts([
                    'http://localhost/scout/public'
                ])
                ->build();
    });
    resolve(EngineManager::class)->extend('elasticsearch', function () {
        return new ElasticSearchEngine(
            app('elasticsearch')
        );
    });
}
My custom search engine code:
<?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->client = $client;
    }
    /**
     * Update the given model in the index.
     *
     * @param  \Illuminate\Database\Eloquent\Collection  $models
     * @return void
     */
    public function update($models)
    {
        $models->each(function($model) {
            $params = [
                'index' => $model->searchableAs(),
                'type' => $model->searchableAs(),
                'id' => $model->id,
                'body' => $model->toSearchableArray()
            ];
            $this->client->index($params);
        });
    }
}
In my case when I try run command php artisan scout:import App\User Elasticsearch package return error with message:
Elasticsearch\Common\Exceptions\NoNodesAvailableException : No alive nodes found in your cluster

How I can solve my problem? Maybe here problem with hosts or xampp setting?
First of all, DON’T PANIC :) I think what you don't have Elasticsearch installed. It will take 5 minutes to install Elasticsearch and solve your problem.
Installation
bin/elasticsearch on Linux or macOS. Run bin\elasticsearch.bat on Windows.curl -X GET http://localhost:9200If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With