Elastica\Type\Mapping::getType PHP Method

getType() public method

Returns mapping type.
public getType ( ) : Type
return Elastica\Type Type
    public function getType()
    {
        return $this->_type;
    }

Usage Example

 /**
  * @return Status
  */
 public function validate()
 {
     $this->outputIndented("Validating mappings...");
     if ($this->optimizeIndexForExperimentalHighlighter && !in_array('experimental highlighter', $this->availablePlugins)) {
         $this->output("impossible!\n");
         return Status::newFatal(new RawMessage("wgCirrusSearchOptimizeIndexForExperimentalHighlighter is set to true but the " . "'experimental highlighter' plugin is not installed on all hosts."));
     }
     $requiredMappings = $this->mappingConfig;
     if (!$this->checkMapping($requiredMappings)) {
         /** @var Mapping[] $actions */
         $actions = array();
         // TODO Conflict resolution here might leave old portions of mappings
         foreach ($this->types as $typeName => $type) {
             $action = new Mapping($type);
             foreach ($requiredMappings[$typeName] as $key => $value) {
                 $action->setParam($key, $value);
             }
             $actions[] = $action;
         }
         try {
             // @todo Use $action->send(array('master_timeout' => ...))
             // after updating to version of Elastica library that supports it.
             // See https://github.com/ruflin/Elastica/pull/1004
             foreach ($actions as $action) {
                 $action->getType()->request('_mapping', Request::PUT, $action->toArray(), array('master_timeout' => $this->masterTimeout));
             }
             $this->output("corrected\n");
         } catch (ExceptionInterface $e) {
             $this->output("failed!\n");
             $message = ElasticsearchIntermediary::extractMessage($e);
             return Status::newFatal(new RawMessage("Couldn't update mappings.  Here is elasticsearch's error message: {$message}\n"));
         }
     }
     return Status::newGood();
 }