PHP Class Elastica\Aggregation\TopHits

Inheritance: extends AbstractAggregation
Show file Open project: ruflin/elastica Class Usage Examples

Public Methods

Method Description
addScriptField ( string $name, Elastica\Script\AbstractScript $script ) Adds a Script to the aggregation.
setExplain ( boolean $explain ) Enables explanation for each hit on how its score was computed.
setFieldDataFields ( array $fields ) Allows to return the field data representation of a field for each hit.
setFrom ( integer $from ) The offset from the first result you want to fetch.
setHighlight ( array $highlightArgs ) Sets highlight arguments for the results.
setScriptFields ( array | ScriptFields $scriptFields ) Set script fields.
setSize ( integer $size ) The maximum number of top matching hits to return per bucket. By default the top three matching hits are returned.
setSort ( array $sortArgs ) How the top matching hits should be sorted. By default the hits are sorted by the score of the main query.
setSource ( array | boolean $params ) Allows to control how the _source field is returned with every hit.
setVersion ( boolean $version ) Returns a version for each search hit.
toArray ( ) : array

Method Details

addScriptField() public method

Adds a Script to the aggregation.
public addScriptField ( string $name, Elastica\Script\AbstractScript $script )
$name string
$script Elastica\Script\AbstractScript

setExplain() public method

Enables explanation for each hit on how its score was computed.
public setExplain ( boolean $explain )
$explain boolean

setFieldDataFields() public method

Allows to return the field data representation of a field for each hit.
public setFieldDataFields ( array $fields )
$fields array

setFrom() public method

The offset from the first result you want to fetch.
public setFrom ( integer $from )
$from integer

setHighlight() public method

Sets highlight arguments for the results.
public setHighlight ( array $highlightArgs )
$highlightArgs array

setScriptFields() public method

Set script fields.
public setScriptFields ( array | ScriptFields $scriptFields )
$scriptFields array | Elastica\Script\ScriptFields

setSize() public method

The maximum number of top matching hits to return per bucket. By default the top three matching hits are returned.
public setSize ( integer $size )
$size integer

setSort() public method

How the top matching hits should be sorted. By default the hits are sorted by the score of the main query.
public setSort ( array $sortArgs )
$sortArgs array

setSource() public method

Allows to control how the _source field is returned with every hit.
public setSource ( array | boolean $params )
$params array | boolean Fields to be returned or false to disable source

setVersion() public method

Returns a version for each search hit.
public setVersion ( boolean $version )
$version boolean

toArray() public method

public toArray ( ) : array
return array