Closed iamalexly closed 2 years ago
I've got same issue.
I think I've now understand correctly this package ^^, but PHPStorm doesn't have a good plugin for Laravel, so it put me on the wrong way.
I think this message can help you @riouruma š
In the config/app.php file, add the provider :
...
'providers' => [
...
Cviebrock\LaravelElasticsearch\ServiceProvider::class,
...
],
...
Also, in the same file, add the aliases :
...
'aliases' => [
...
'Elasticsearch' => Cviebrock\LaravelElasticsearch\Facade::class
...
],
...
Now, you can use the alias Elasticsearch into your commands/controllers...
use Elasticsearch;
And call all the methods in static :
$return = Elasticsearch::watcher();
dump($return);
Return of this two lines :
#serializer: Elasticsearch\Serializers\SmartSerializer {#400 ā¦}
#transportSchema: "http"
#host: "elasticsearch"
#path: null
#port: "9200"
Now, my environment variables are used.
In fact, the ClientBuilder isn't a fonctionnality of this package but a fonctionnality of the Elastic PHP Package š
In my opinion, the biggest problem is I'm using PHPStorm. He doesn't recognize the Elasticsearch namespace, so he doesn't autocomplete the methods available.
Also, if you use a tool like SonarQube, your code is considered as wrong because the namespace is not found...
Closing old tickets.
Hi all,
I want to use this package with Laravel 8, so I've install the package and publish the configuration file. After that step, I've add the differents environment variables :
I've created a Laravel command to test the package. Here, the code of the handle method of the command :
And the dump response in the console :
So, my configuration is not set.
If I change the host directly when I create the ClientBuilder like :
I've this response :
So, if I don't change the host when I create the ClientBuilder, the package doesn't detect any nodes... but if I precise the host when I create the ClientBuilder, it's works !
Also, I've clear my cache and my config...
I don't understand, if anyone have an answer, I would gladly take it š