本文整理汇总了PHP中Elastica\Type\Mapping::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Mapping::getType方法的具体用法?PHP Mapping::getType怎么用?PHP Mapping::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elastica\Type\Mapping
的用法示例。
在下文中一共展示了Mapping::getType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* @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();
}