public static function allResourcePaginated($query, $index, $type = null)
 {
     $perPage = Request::input('perPage', 15);
     $from = $perPage * (Request::input('page', 1) - 1);
     $searchParams = array('body' => $query, 'size' => $perPage, 'from' => $from);
     $searchParams['index'] = $index;
     if ($type) {
         $searchParams['type'] = $type;
     }
     $client = self::getClient();
     $queryResponse = $client->search($searchParams);
     foreach ($queryResponse['hits']['hits'] as &$obj) {
         $obj['_source']['providerAcro'] = Utils::getProviderName($obj['_source']['providerId']);
     }
     $paginator = new LengthAwarePaginator($queryResponse['hits']['hits'], $queryResponse['hits']['total'], $perPage, Paginator::resolveCurrentPage(), ['path' => Paginator::resolveCurrentPath()]);
     return $paginator;
 }