/**
  * @param $study
  * @return the seven most similar studies based on subjects
  */
 public static function thematicallySimilarQuery($resource)
 {
     $json = '{
     "query": {
       "bool": {
         "must_not": {
           "match": {
             "_id": "' . $resource['_id'] . '"
           }
         },
         "should": [';
     $firstMatch = true;
     if (array_key_exists('nativeSubject', $resource['_source'])) {
         foreach ($resource['_source']['keyword']['en'] as $subject) {
             if ($firstMatch) {
                 $firstMatch = false;
             } else {
                 $json .= ',';
             }
             $json .= '{
           "match": {
             "keyword.en": "' . $subject . '"
           }
         }';
         }
     }
     $json .= '],
           "minimum_should_match" : 1
         }
       }
     }';
     $params = ['index' => 'study', 'type' => 'studytype', 'size' => 7, 'body' => $json];
     $result = ElasticSearch::getClient()->search($params);
     return $result['hits']['hits'];
 }