PHP Class Elastica\Response

Stores query time, and result array -> is given to result set, returned by ...
Author: Nicolas Ruflin ([email protected])
Show file Open project: ruflin/elastica Class Usage Examples

Protected Properties

Property Type Description
$_error Error.
$_jsonBigintConversion boolean Whether or not to convert bigint results to string (see issue #717).
$_queryTime Query time.
$_response array | null Response.
$_responseString Response string (json).
$_status integer HTTP response status code.
$_transferInfo Transfer info.

Public Methods

Method Description
__construct ( string | array $responseString, integer $responseStatus = null ) Construct.
getData ( ) : array Response data array.
getEngineTime ( ) : integer Time request took.
getError ( ) : string Error message.
getErrorMessage ( ) : string
getFullError ( ) : array | string A keyed array representing any errors that occured.
getJsonBigintConversion ( ) : boolean Gets whether or not to apply bigint conversion on the JSON result.
getQueryTime ( ) : float Returns query execution time.
getScrollId ( ) : string Get the _scroll value for the response.
getShardsStatistics ( ) : array Get the _shard statistics for the response.
getStatus ( ) : integer
getTransferInfo ( ) : array Gets the transfer information.
hasError ( ) : boolean True if response has error.
hasFailedShards ( ) : boolean True if response has failed shards.
isOk ( ) : boolean Checks if the query returned ok.
setJsonBigintConversion ( boolean $jsonBigintConversion ) Sets whether or not to apply bigint conversion on the JSON result.
setQueryTime ( float $queryTime ) Sets the query time.
setTransferInfo ( array $transferInfo ) Sets the transfer info of the curl request. This function is called from the \Elastica\Client::_callService .

Method Details

__construct() public method

Construct.
public __construct ( string | array $responseString, integer $responseStatus = null )
$responseString string | array Response string (json)
$responseStatus integer http status code

getData() public method

Response data array.
public getData ( ) : array
return array Response data array

getEngineTime() public method

Time request took.
public getEngineTime ( ) : integer
return integer Time request took

getError() public method

Error message.
public getError ( ) : string
return string Error message

getErrorMessage() public method

public getErrorMessage ( ) : string
return string Error string based on the error object

getFullError() public method

In case of http://localhost:9200/_alias/test the error is a string
public getFullError ( ) : array | string
return array | string Error data

getJsonBigintConversion() public method

Gets whether or not to apply bigint conversion on the JSON result.

getQueryTime() public method

Returns query execution time.
public getQueryTime ( ) : float
return float Query time

getScrollId() public method

Get the _scroll value for the response.
public getScrollId ( ) : string
return string

getShardsStatistics() public method

Get the _shard statistics for the response.
public getShardsStatistics ( ) : array
return array

getStatus() public method

public getStatus ( ) : integer
return integer

getTransferInfo() public method

Gets the transfer information.
public getTransferInfo ( ) : array
return array Information about the curl request.

hasError() public method

True if response has error.
public hasError ( ) : boolean
return boolean True if response has error

hasFailedShards() public method

True if response has failed shards.
public hasFailedShards ( ) : boolean
return boolean True if response has failed shards

isOk() public method

Checks if the query returned ok.
public isOk ( ) : boolean
return boolean True if ok

setJsonBigintConversion() public method

Sets whether or not to apply bigint conversion on the JSON result.
public setJsonBigintConversion ( boolean $jsonBigintConversion )
$jsonBigintConversion boolean

setQueryTime() public method

Sets the query time.
public setQueryTime ( float $queryTime )
$queryTime float Query time

setTransferInfo() public method

Sets the transfer info of the curl request. This function is called from the \Elastica\Client::_callService .
public setTransferInfo ( array $transferInfo )
$transferInfo array The curl transfer information.

Property Details

$_error protected property

Error.
protected $_error

$_jsonBigintConversion protected property

Whether or not to convert bigint results to string (see issue #717).
protected bool $_jsonBigintConversion
return boolean

$_queryTime protected property

Query time.
protected $_queryTime

$_response protected property

Response.
protected array|null $_response
return array | null

$_responseString protected property

Response string (json).
protected $_responseString

$_status protected property

HTTP response status code.
protected int $_status
return integer

$_transferInfo protected property

Transfer info.
protected $_transferInfo