当前位置: 首页>>代码示例>>PHP>>正文


PHP Index::getMapping方法代码示例

本文整理汇总了PHP中Elastica\Index::getMapping方法的典型用法代码示例。如果您正苦于以下问题:PHP Index::getMapping方法的具体用法?PHP Index::getMapping怎么用?PHP Index::getMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Elastica\Index的用法示例。


在下文中一共展示了Index::getMapping方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMetaData

 /**
  * @return array
  */
 public function getMetaData()
 {
     $metaData = [];
     try {
         $mapping = $this->index->getMapping();
         if (isset($mapping['page']) && isset($mapping['page']['_meta'])) {
             $metaData = $mapping['page']['_meta'];
         }
     } catch (ResponseException $e) {
         // legal catch, if no mapping found (fresh installation etc) we still want to show empty meta data
     }
     return $metaData;
 }
开发者ID:spryker,项目名称:Search,代码行数:16,代码来源:SearchIndexManager.php

示例2: checkMapping

 /**
  * Check that the mapping returned from Elasticsearch is as we want it.
  *
  * @param array $requiredMappings the mappings we want
  * @return bool is the mapping good enough for us?
  */
 private function checkMapping($requiredMappings)
 {
     $actualMappings = $this->index->getMapping();
     $this->output("\n");
     $this->outputIndented("\tValidating mapping...");
     if ($this->checkConfig($actualMappings, $requiredMappings)) {
         $this->output("ok\n");
         return true;
     } else {
         $this->output("different...");
         return false;
     }
 }
开发者ID:zoglun,项目名称:mediawiki-extensions-CirrusSearch,代码行数:19,代码来源:MappingValidator.php

示例3: copy

 /**
  * Copies type mappings and documents from an old index to a new index.
  *
  * @see \Elastica\Tool\CrossIndex::reindex()
  *
  * @param \Elastica\Index $oldIndex
  * @param \Elastica\Index $newIndex
  * @param array           $options  keys: CrossIndex::OPTION_* constants
  *
  * @return \Elastica\Index The new index object
  */
 public static function copy(Index $oldIndex, Index $newIndex, array $options = array())
 {
     // normalize types to array of string
     $types = array();
     if (isset($options[self::OPTION_TYPE])) {
         $types = $options[self::OPTION_TYPE];
         $types = is_array($types) ? $types : array($types);
         $types = array_map(function ($type) {
             if ($type instanceof Type) {
                 $type = $type->getName();
             }
             return (string) $type;
         }, $types);
     }
     // copy mapping
     foreach ($oldIndex->getMapping() as $type => $mapping) {
         if (!empty($types) && !in_array($type, $types, true)) {
             continue;
         }
         $type = new Type($newIndex, $type);
         $type->setMapping($mapping['properties']);
     }
     // copy documents
     return self::reindex($oldIndex, $newIndex, $options);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:36,代码来源:CrossIndex.php


注:本文中的Elastica\Index::getMapping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。