Class yii\elasticsearch\ActiveDataProvider

Inheritanceyii\elasticsearch\ActiveDataProvider » yii\data\ActiveDataProvider
Available since version2.0.5

ActiveDataProvider is an enhanced version of \yii\data\ActiveDataProvider specific to the ElasticSearch.

It allows to fetch not only rows and total rows count, but full query results including aggregations and so on.

Note: this data provider fetches result models and total count using single ElasticSearch query, so results total count will be fetched after pagination limit applying, which eliminates ability to verify if requested page number actually exist. Data provider disables \yii\elasticsearch\yii\data\Pagination::validatePage automatically because of this.

Method Details

getAggregation() public method

Returns results of the specified aggregation.

public array getAggregation ( $name )
$name string

Aggregation name.

return array

Aggregation results.

throws \yii\base\InvalidCallException

if requested aggregation does not present in query results.

getAggregations() public method

public array getAggregations ( )
return array

All aggregations results

getQueryResults() public method

public array getQueryResults ( )
return array

Full query results

prepareKeys() protected method

protected void prepareKeys ( $models )
prepareModels() protected method

protected void prepareModels ( )
prepareTotalCount() protected method

protected void prepareTotalCount ( )
refresh() public method

public void refresh ( )
setQueryResults() public method

public void setQueryResults ( $results )
$results array

Full query results