public function paginateES(int $size = 20, string $sortBy = "", string $sortType = "ASC", int $page = null) : LengthAwarePaginator
    {
        if(!$page) {
            $page = (Input::get("page") ? Input::get("page") : 1);
        }

        $from = (($page * $size) - $size);

        $data = $this->getESItems($size, $from, $sortBy, $sortType);
        return new LengthAwarePaginator($data['items'], $data['elasticData']['hits']['total'], $size, $page);
    }
public function paginateES(int $size = 20, string $sortBy = "", string $sortType = "ASC", int $page = null) : LengthAwarePaginator
    {
        if(!$page) {
            $page = (Input::get("page") ? Input::get("page") : 1);
        }

        $from = (($page * $size) - $size);

        $data = $this->getESItems($size, $from, $sortBy, $sortType);
        return new LengthAwarePaginator($data['items'], $data['elasticData']['hits']['total'], $size, $page);
    }
public function paginateES ( int $ size = 20 , string $ sortBy = "" , string $ sortType = "ASC" , int $ page = null ) : LengthAwarePaginator { if ( ! $ page ) { $ page = ( Input :: get ( "page" ) ? Input :: get ( "page" ) : 1 ) ; } $ from = ( ( $ page * $ size ) - $ size ) ; $ data = $ this -> getESItems ( $ size , $ from , $ sortBy , $ sortType ) ; return new LengthAwarePaginator ( $ data [ 'items' ] , $ data [ 'elasticData' ] [ 'hits' ] [ 'total' ] , $ size , $ page ) ; }
Get data as pagination from elastic index.

@param  int      $size
@param  string   $sortBy
@param  string   $sortType
@param  int|null $page
@return LengthAwarePaginator
Get data as pagination from elastic index .