We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The return typehint on Elasticsearch\Client::performRequest() is incorrect for async requests as these return a FutureArrayInterface
Elasticsearch\Client::performRequest()
FutureArrayInterface
In the below code $aAddressBatch is an array of 100 documents to send to ES for indexing:
$aAddressBatch
$oESClientBuilder = Elasticsearch\ClientBuilder::create(); $oESClientBuilder->setHosts(['192.168.0.114', '192.168.0.115']); $oDefaultHandler = Elasticsearch\ClientBuilder::defaultHandler(['max_handles' => 5]); $oESClientBuilder->setHandler($oDefaultHandler); $oESClient = $oESClientBuilder->build(); $aESBody = []; foreach ($aAddressBatch as $aAddress) { $aESBody[] = [ 'index' => [ '_index' => $this->sIndexName, ] ]; $aESBody[] = $aAddress; } $aParams = [ 'client' => [ 'future' => 'lazy', ], 'body' => $aESBody ]; $aResponse = $oESClient->bulk($aParams),
Exception thrown: TypeError: Return value of Elasticsearch\Client::performRequest() must be of the type array, object returned
Backtrace:
Elasticsearch\Client->performRequest (…/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php:742) array(1) 0: object: Elasticsearch\Endpoints\Bulk
Elasticsearch\Client->performRequest
Elasticsearch\Client->bulk
The text was updated successfully, but these errors were encountered:
Thanks @crispygoth for reporting the issue. I've created PR #905 for fixing the bug.
Sorry, something went wrong.
ezimuel
Successfully merging a pull request may close this issue.
Summary of problem or feature request
The return typehint on
Elasticsearch\Client::performRequest()
is incorrect for async requests as these return aFutureArrayInterface
Code snippet of problem
In the below code
$aAddressBatch
is an array of 100 documents to send to ES for indexing:Exception details
Exception thrown: TypeError: Return value of Elasticsearch\Client::performRequest() must be of the type array, object returned
Backtrace:
Elasticsearch\Client->performRequest
(…/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php:742)array(1)
0: object: Elasticsearch\Endpoints\Bulk
Elasticsearch\Client->bulk
System details
The text was updated successfully, but these errors were encountered: