Uncaught TypeError: Return value of Elasticsearch\ClientBuilder::buildLoggers() must be an instance of Elasticsearch\void, none returned

When i try to initialize client i get this error:
Fatal error : Uncaught TypeError: Return value of Elasticsearch\ClientBuilder::buildLoggers() must be an instance of Elasticsearch\void, none returned in C:\inetpub\wwwroot\composerModules\elasticsearch\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ClientBuilder.php:501 Stack trace: #0 C:\inetpub\wwwroot\composerModules\elasticsearch\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ClientBuilder.php(393): Elasticsearch\ClientBuilder->buildLoggers() #1 C:\inetpub\wwwroot\composerModules\elasticsearch\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ClientBuilder.php on line 501

Here's mine code

$clientElastic = Elasticsearch\ClientBuilder::create()->setHosts($CI->config->item('elasticsearch'))->build();

Have you found any solution to this ?? i'm getting this error too and got stuck completly.

Yes i found it. Problem was that i was running PHP 7.0. I replaced it with PHP 7.1 and it started working.

1 Like

But i'm already using php 7.2.24 it's still not wroking. should i upgrade it to 7.3 ? because its working on localhost and localhost php version is 7.3.
Thanks for your response btw :slightly_smiling_face:

Maybe check version of elasticsearch library? Im using 7.0.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.