\ElasticaResultSet

Elastica result set.

List of all hits that are returned for a search on elasticsearch Result set implements iterator

Summary

Methods
Properties
Constants
__construct()
getResults()
getDocuments()
hasSuggests()
getSuggests()
hasAggregations()
getAggregations()
getAggregation()
getTotalHits()
getMaxScore()
getTotalTime()
hasTimedOut()
getResponse()
getQuery()
count()
countSuggests()
current()
next()
key()
valid()
rewind()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
No public properties found
No constants found
No protected methods found
$_maxScore
$_position
$_query
$_response
$_results
$_timedOut
$_took
$_totalHits
N/A
No private methods found
No private properties found
N/A

Properties

$_maxScore

$_maxScore : float

Type

float

$_position

$_position : integer

Current position.

Type

integer — Current position

$_query

$_query : \Elastica\Query

Query.

Type

\Elastica\Query — Query object

$_response

$_response : \Elastica\Response

Response.

Type

\Elastica\Response — Response object

$_results

$_results : array<mixed,\Elastica\Result>

Results.

Type

array<mixed,\Elastica\Result> — Results

$_timedOut

$_timedOut : boolean

Type

boolean

$_took

$_took : integer

Type

integer

$_totalHits

$_totalHits : integer

Type

integer

Methods

__construct()

__construct(\Elastica\Response  $response, \Elastica\Query  $query, array<mixed,\Elastica\Result>  $results) 

Constructs ResultSet object.

Parameters

\Elastica\Response $response

Response object

\Elastica\Query $query

Query object

array<mixed,\Elastica\Result> $results

getResults()

getResults() : array<mixed,\Elastica\Result>

Returns all results.

Returns

array<mixed,\Elastica\Result> —

Results

getDocuments()

getDocuments() : array

Returns all Documents.

Returns

array —

Documents \Elastica\Document

hasSuggests()

hasSuggests() : boolean

Returns true if the response contains suggestion results; false otherwise.

Returns

boolean

getSuggests()

getSuggests() : array

Return all suggests.

Returns

array —

suggest results

hasAggregations()

hasAggregations() : boolean

Returns whether aggregations exist.

Returns

boolean —

Aggregation existence

getAggregations()

getAggregations() : array

Returns all aggregation results.

Returns

array

getAggregation()

getAggregation(string  $name) : array

Retrieve a specific aggregation from this result set.

Parameters

string $name

the name of the desired aggregation

Throws

\Elastica\Exception\InvalidException

if an aggregation by the given name cannot be found

Returns

array

getTotalHits()

getTotalHits() : integer

Returns the total number of found hits.

Returns

integer —

Total hits

getMaxScore()

getMaxScore() : float

Returns the max score of the results found.

Returns

float —

Max Score

getTotalTime()

getTotalTime() : integer

Returns the total number of ms for this search to complete.

Returns

integer —

Total time

hasTimedOut()

hasTimedOut() : boolean

Returns true if the query has timed out.

Returns

boolean —

Timed out

getResponse()

getResponse() : \Elastica\Response

Returns response object.

Returns

\Elastica\Response

Response object

count()

count() : integer

Returns size of current set.

Returns

integer —

Size of set

countSuggests()

countSuggests() : integer

Returns size of current suggests.

Returns

integer —

Size of suggests

current()

current() : \Elastica\Result|boolean

Returns the current object of the set.

Returns

\Elastica\Result|boolean —

Set object or false if not valid (no more entries)

next()

next() 

Sets pointer (current) to the next item of the set.

key()

key() : integer

Returns the position of the current entry.

Returns

integer —

Current position

valid()

valid() : boolean

Check if an object exists at the current position.

Returns

boolean —

True if object exists

rewind()

rewind() 

Resets position to 0, restarts iterator.

offsetExists()

offsetExists(integer  $offset) : boolean

Whether a offset exists.

Parameters

integer $offset

Returns

boolean —

true on success or false on failure.

offsetGet()

offsetGet(integer  $offset) : \Elastica\Result|null

Offset to retrieve.

Parameters

integer $offset

Throws

\Elastica\Exception\InvalidException

If offset doesn't exist

Returns

\Elastica\Result|null

offsetSet()

offsetSet(integer  $offset, \Elastica\Result  $value) 

Offset to set.

Parameters

integer $offset
\Elastica\Result $value

Throws

\Elastica\Exception\InvalidException

offsetUnset()

offsetUnset(integer  $offset) 

Offset to unset.

Parameters

integer $offset