/**
  * Checks whether a job exists or not
  * A Job is uniquely identified by three parameters
  * userId, type, and rundate
  * @param ESJob $job
  */
 public function jobExists(ESJob $job)
 {
     $params = array();
     $params['index'] = $this->indexName;
     $params['type'] = $this->getJobType();
     $date = $job->getRunDate()->format('Y-m-d');
     $query = array('filtered' => array('filter' => array('and' => array(array("numeric_range" => array("runDate" => array('gte' => $date, 'lte' => $date))), array("term" => array("jobType" => $job->getJobType())), array("term" => array("userId" => $job->getUserId()))))));
     $params['body']['query'] = $query;
     $results = $this->esClient->search($params);
     return $results['hits']['total'] != 0;
 }