in src/Client.php [183:209]
public function sendRequest(RequestInterface $request)
{
// If async returns a Promise
if ($this->getAsync()) {
if ($this->getElasticMetaHeader()) {
$this->transport->setElasticMetaHeader(Client::CLIENT_NAME, Client::VERSION, true);
}
$this->transport->setAsyncOnSuccess(
$request->getMethod() === 'HEAD'
? new AsyncOnSuccessNoException($this)
: ($this->getResponseException() ? new AsyncOnSuccess($this) : new AsyncOnSuccessNoException($this))
);
return $this->transport->sendAsyncRequest($request);
}
if ($this->getElasticMetaHeader()) {
$this->transport->setElasticMetaHeader(Client::CLIENT_NAME, Client::VERSION, false);
}
$start = microtime(true);
$response = $this->transport->sendRequest($request);
$this->logger->info(sprintf("Response time in %.3f sec", microtime(true) - $start));
$result = new Elasticsearch;
$result->setResponse($response, $request->getMethod() === 'HEAD' ? false : $this->getResponseException());
$this->serverless = $result->isServerless();
return $result;
}