private function getESItems($size, $from, string $sortBy = "", string $sortType = "ASC")
    {
        $query = [
            "match_all" => (object) []
        ];

        if($this->elasticQuery) {
            $query = [
                "bool" => [
                    "must" => $this->elasticQuery
                ]
            ];
        }

        $params = [
            "index" => $this->table,
            "type" => "_doc",
            "body" => [
                "size" => $size,
                "from" => $from,
                "query" => $query
            ]
        ];

        if($sortBy) {
            $params['body']['sort'] = [
                [
                    $sortBy => [ "order" => strtoupper($sortType) ]
                ]
            ];
        }

        $elasticData = $this->elastic->search($params);
        $items = collect();
        $count = 0;
        foreach ($elasticData['hits']['hits'] as $item){
            $data = $item["_source"];
            $data[$this->primaryKey] = $item["_id"];
            $items->put($count++, $this->toElequent($data));
        }

        return [
            "items" => $items,
            "elasticData" => $elasticData,
        ];
    }
private function getESItems($size, $from, string $sortBy = "", string $sortType = "ASC")
    {
        $query = [
            "match_all" => (object) []
        ];

        if($this->elasticQuery) {
            $query = [
                "bool" => [
                    "must" => $this->elasticQuery
                ]
            ];
        }

        $params = [
            "index" => $this->table,
            "type" => "_doc",
            "body" => [
                "size" => $size,
                "from" => $from,
                "query" => $query
            ]
        ];

        if($sortBy) {
            $params['body']['sort'] = [
                [
                    $sortBy => [ "order" => strtoupper($sortType) ]
                ]
            ];
        }

        $elasticData = $this->elastic->search($params);
        $items = collect();
        $count = 0;
        foreach ($elasticData['hits']['hits'] as $item){
            $data = $item["_source"];
            $data[$this->primaryKey] = $item["_id"];
            $items->put($count++, $this->toElequent($data));
        }

        return [
            "items" => $items,
            "elasticData" => $elasticData,
        ];
    }
private function getESItems ( $ size , $ from , string $ sortBy = "" , string $ sortType = "ASC" ) { $ query = [ "match_all" => ( object ) [ ] ] ; if ( $ this -> elasticQuery ) { $ query = [ "bool" => [ "must" => $ this -> elasticQuery ] ] ; } $ params = [ "index" => $ this -> table , "type" => "_doc" , "body" => [ "size" => $ size , "from" => $ from , "query" => $ query ] ] ; if ( $ sortBy ) { $ params [ 'body' ] [ 'sort' ] = [ [ $ sortBy => [ "order" => strtoupper ( $ sortType ) ] ] ] ; } $ elasticData = $ this -> elastic -> search ( $ params ) ; $ items = collect ( ) ; $ count = 0 ; foreach ( $ elasticData [ 'hits' ] [ 'hits' ] as $ item ) { $ data = $ item [ "_source" ] ; $ data [ $ this -> primaryKey ] = $ item [ "_id" ] ; $ items -> put ( $ count ++ , $ this -> toElequent ( $ data ) ) ; } return [ "items" => $ items , "elasticData" => $ elasticData , ] ; }
Used to get data and return them as Elequent.

@param  $size
@param  $from
@param  string $sortBy
@param  string $sortType
@return array
Used to get data and return them as Elequent .