private function updateDirectoryMapping($deleteMapping)
 {
     $es = $this->getContainer()->get('es_client');
     // Elastic Search client
     // Do it for the course mapping
     $params = array();
     $params['index'] = $this->getContainer()->getParameter('es_index_name');
     $params['type'] = 'course';
     if ($deleteMapping) {
         $es->indices()->deleteMapping($params);
     }
     // Get the mapping
     $cDoc = new CourseDocumentType(new Course(), $this->getContainer());
     $mapping = array('_source' => array('enabled' => true), 'properties' => $cDoc->getMapping());
     $params['body']['course'] = $mapping;
     $es->indices()->putMapping($params);
     // Credential Mapping
     $params = array();
     $params['index'] = $this->getContainer()->getParameter('es_index_name');
     $params['type'] = 'credential';
     $credentialDoc = new CredentialDocumentType(new \ClassCentral\CredentialBundle\Entity\Credential(), $this->getContainer());
     if ($deleteMapping) {
         $es->indices()->deleteMapping($params);
     }
     $mapping = array('_source' => array('enabled' => true), 'properties' => $credentialDoc->getMapping());
     $params['body']['credential'] = $mapping;
     $es->indices()->putMapping($params);
     // Suggest Document mapping
     $params = array();
     $params['index'] = $this->getContainer()->getParameter('es_index_name');
     $params['type'] = 'suggest';
     if ($deleteMapping) {
         $es->indices()->deleteMapping($params);
     }
     // Get the mapping
     $sDoc = new SuggestDocumentType(new Course(), $this->getContainer());
     $mapping = array('_source' => array('enabled' => true), 'properties' => $sDoc->getMapping());
     $params['body']['suggest'] = $mapping;
     $es->indices()->putMapping($params);
 }