src/ElasticsearchMock/Client.php
protected function getMethodResult($method, array $arguments)
    {
        if (!is_callable(['Elasticsearch\Client', $method])) {
            trigger_error(
                sprintf('Call to undefined or protected/private method %s::%s()', get_called_class(), $method),
                E_USER_ERROR
            );
        }

        if (empty($this->results[$method])) {
            throw new \Exception(
                sprintf("ElasticsearchMock results is empty for %s", $method)
            );
        }

        $this->calls[$method][] = $arguments;

        return array_shift($this->results[$method]);
    }
protected function getMethodResult($method, array $arguments)
    {
        if (!is_callable(['Elasticsearch\Client', $method])) {
            trigger_error(
                sprintf('Call to undefined or protected/private method %s::%s()', get_called_class(), $method),
                E_USER_ERROR
            );
        }

        if (empty($this->results[$method])) {
            throw new \Exception(
                sprintf("ElasticsearchMock results is empty for %s", $method)
            );
        }

        $this->calls[$method][] = $arguments;

        return array_shift($this->results[$method]);
    }
Try to find a result and logs the call

@param string $method
@param array  $arguments

@throws \Exception
@return mixed