public static function getResourceTitle($resourceId)
 {
     $query = ['query' => ['match' => ['_id' => $resourceId]]];
     $provider = ElasticSearch::allHits($query, 'catalog', 'resource');
     if (count($provider) > 0) {
         return $provider[0]['_source']['title'];
     } else {
         return '';
     }
 }
 /**
  * Get statistics for each provider with new providers table and through ElasticSearch
  * 
  * @return Array list of providers with statistics
  */
 public static function statistics()
 {
     $providers = Utils::getProvidersES();
     foreach ($providers as &$provider) {
         $query = ['query' => ['match' => ['providerId' => $provider['_source']['id']]]];
         $provider['collections'] = ElasticSearch::countHits($query, 'resource', 'collection');
         $provider['datasets'] = ElasticSearch::countHits($query, 'resource', 'dataset');
         $provider['databases'] = ElasticSearch::countHits($query, 'resource', 'database');
         $provider['gis'] = ElasticSearch::countHits($query, 'resource', 'gis');
         $provider['textualDocuments'] = ElasticSearch::countHits($query, 'resource', 'textualDocument');
     }
     return $providers;
 }
 public static function searchResults($data)
 {
     $query = ['filter' => ['geo_bounding_box' => ['spatial.location' => ['top_left' => ['lat' => $data['top_left_lan'], 'lon' => $data['top_left_lon']], 'bottom_right' => ['lat' => $data['bottom_right_lan'], 'lon' => $data['bottom_right_lon']]]]]];
     $resources = ElasticSearch::allHits($query, 'resource');
     return $resources;
 }
 /**
  * @param $resource
  * @return count of parts in a collection
  */
 public static function getPartsCountQuery($resource)
 {
     $json = '{ "query": { "match" : { "isPartOf": ' . $resource['_id'] . ' } } }';
     $params = ['index' => Config::get('app.elastic_search_catalog_index'), 'type' => self::RESOURCE_TYPE, 'body' => $json];
     $result = ElasticSearch::getClient()->search($params);
     return $result['hits']['total'];
 }