lib/Elastica/Client.php
public function request($path, $method = Request::GET, $data = [], array $query = [], $contentType = Request::DEFAULT_CONTENT_TYPE)
    {
        $connection = $this->getConnection();
        $request = $this->_lastRequest = new Request($path, $method, $data, $query, $connection, $contentType);
        $this->_lastResponse = null;

        try {
            $response = $this->_lastResponse = $request->send();
        } catch (ConnectionException $e) {
            $this->_connectionPool->onFail($connection, $e, $this);

            $this->_log($e);

            // In case there is no valid connection left, throw exception which caused the disabling of the connection.
            if (!$this->hasConnection()) {
                throw $e;
            }

            return $this->request($path, $method, $data, $query);
        }

        $this->_log($request);

        return $response;
    }
public function request($path, $method = Request::GET, $data = [], array $query = [], $contentType = Request::DEFAULT_CONTENT_TYPE)
    {
        $connection = $this->getConnection();
        $request = $this->_lastRequest = new Request($path, $method, $data, $query, $connection, $contentType);
        $this->_lastResponse = null;

        try {
            $response = $this->_lastResponse = $request->send();
        } catch (ConnectionException $e) {
            $this->_connectionPool->onFail($connection, $e, $this);

            $this->_log($e);

            // In case there is no valid connection left, throw exception which caused the disabling of the connection.
            if (!$this->hasConnection()) {
                throw $e;
            }

            return $this->request($path, $method, $data, $query);
        }

        $this->_log($request);

        return $response;
    }
public function request ( $ path , $ method = Request :: GET , $ data = [ ] , array $ query = [ ] , $ contentType = Request :: DEFAULT_CONTENT_TYPE ) { $ connection = $ this -> getConnection ( ) ; $ request = $ this -> _lastRequest = new Request ( $ path , $ method , $ data , $ query , $ connection , $ contentType ) ; $ this -> _lastResponse = null ; try { $ response = $ this -> _lastResponse = $ request -> send ( ) ; } catch ( ConnectionException $ e ) { $ this -> _connectionPool -> onFail ( $ connection , $ e , $ this ) ; $ this -> _log ( $ e ) ; // In case there is no valid connection left, throw exception which caused the disabling of the connection. if ( ! $ this -> hasConnection ( ) ) { throw $ e ; } return $ this -> request ( $ path , $ method , $ data , $ query ) ; } $ this -> _log ( $ request ) ; return $ response ; }
Makes calls to the elasticsearch server based on this index.

It's possible to make any REST query directly over this method

@param string       $path        Path to call
@param string       $method      Rest method to use (GET, POST, DELETE, PUT)
@param array|string $data        OPTIONAL Arguments as array or pre-encoded string
@param array        $query       OPTIONAL Query params
@param string       $contentType Content-Type sent with this request

@throws Exception\ConnectionException|Exception\ClientException

@return Response Response object
Makes calls to the elasticsearch server based on this index .