http://wiki.commonjs.org/wiki/Packages/Mappings/A 如果模块名以 / 结尾，自动加 index
168401
function indexMap(s) {
        if (typeof s == 'string') {
            return indexMapStr(s);
        } else {
            var ret = [],
                i = 0,
                l = s.length;
            for (; i < l; i++) {
                ret[i] = indexMapStr(s[i]);
            }
            return ret;
        }
    }
729105
private function addMappings()
    {
        $indicesSettings = $this->indexSettings->getIndicesConfig();

        foreach ($this->_data as $requestName => $requestConfig) {
            $index = $requestConfig['index'];
            $this->_data[$requestName]['mapping'] = $indicesSettings[$index]['mapping'];
        }

        return $this;
    }
43728
function indexWidgets() {
  const { widgets = {} } = getComponentsSettings();

  return index({
    file: 'widgets.js',
    config: {
      type: TYPE_WIDGETS,
      config: widgets,
    },
    ...getIndexLogTranslations(TYPE_WIDGETS),
  });
}
1112087
public String addDocument(String indexName, String indexType, Object params,ClientOptions clientOptions) throws ElasticSearchException{
		if(params instanceof Map){
			return addMapDocument(indexName,indexType,(Map)params,clientOptions);
		}
		Object docId = null;
		Object parentId = null;
		Object routing = null;
		String refreshOption = null;
		if(clientOptions != null) {
			refreshOption = clientOptions.getRefreshOption();
			ClassUtil.ClassInfo beanClassInfo = ClassUtil.getClassInfo(params.getClass());
			docId = clientOptions.getIdField() != null ? BuildTool.getId(params, beanClassInfo, clientOptions.getIdField()) : null;
			parentId = clientOptions.getParentIdField() != null ? BuildTool.getParentId(params, beanClassInfo, clientOptions.getParentIdField()) : null;
			routing = clientOptions.getRountField() != null ? BuildTool.getRouting(params, beanClassInfo, clientOptions.getRountField()) : null;
		}
		return addDocument(  indexName,   indexType,   params,  docId,  parentId,  routing,  refreshOption);
	}
689106
def init_index(self, app=None):
        """"""
        elasticindexes = self._get_indexes()

        for index, settings in elasticindexes.items():
            es = settings['resource']
            if not es.indices.exists(index):
                self.create_index(index, settings.get('index_settings'), es)
                continue
            else:
                self.put_settings(app, index, settings.get('index_settings').get('settings'), es)

            for mapping_type, mappings in settings.get('index_settings', {}).get('mappings').items():
                self._put_resource_mapping(mapping_type, es,
                                           properties=mappings,
                                           index=index, doc_type=mapping_type)
        return
162186
public function addPropertyIndex()
    {
        if(!$this->isXmlHttpRequest()){
            throw new common_exception_BadRequest('wrong request mode');
        }
        if(!$this->hasRequestParameter('uri')){
            throw new Exception("wrong request Parameter");
        }
        $uri = $this->getRequestParameter('uri');

        $clazz = $this->getCurrentClass();

        $index = 1;
        if($this->hasRequestParameter('index')){
            $index = $this->getRequestParameter('index');
        }

        $propertyIndex = 1;
        if($this->hasRequestParameter('propertyIndex')){
            $propertyIndex = $this->getRequestParameter('propertyIndex');
        }

        //create and attach the new index property to the property
        $property = $this->getProperty(tao_helpers_Uri::decode($uri));
        $class = $this->getClass("http://www.tao.lu/Ontologies/TAO.rdf#Index");

        //get property range to select a default tokenizer
        /** @var core_kernel_classes_Class $range */
        $range = $property->getRange();
        //range is empty select item content
        $tokenizer = null;
        if (is_null($range)) {
            $tokenizer = $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#RawValueTokenizer');
        } else {
            $tokenizer = $range->getUri() === OntologyRdfs::RDFS_LITERAL
                ? $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#RawValueTokenizer')
                : $this->getResource('http://www.tao.lu/Ontologies/TAO.rdf#LabelTokenizer');
        }

        $indexClass = $this->getClass('http://www.tao.lu/Ontologies/TAO.rdf#Index');
        $i = 0;
        $indexIdentifierBackup = preg_replace('/[^a-z_0-9]/','_',strtolower($property->getLabel()));
        $indexIdentifierBackup = ltrim(trim($indexIdentifierBackup, '_'),'0..9');
        $indexIdentifier = $indexIdentifierBackup;
        do{
            if($i !== 0){
                $indexIdentifier = $indexIdentifierBackup.'_'.$i;
            }
            $resources = $indexClass->searchInstances(array(OntologyIndex::PROPERTY_INDEX_IDENTIFIER => $indexIdentifier), array('like' => false));
            $count = count($resources);
            $i++;
        }while($count !== 0);

        $indexProperty = $class->createInstanceWithProperties(array(
                OntologyRdfs::RDFS_LABEL => preg_replace('/_/',' ',ucfirst($indexIdentifier)),
                OntologyIndex::PROPERTY_INDEX_IDENTIFIER => $indexIdentifier,
                OntologyIndex::PROPERTY_INDEX_TOKENIZER => $tokenizer,
                OntologyIndex::PROPERTY_INDEX_FUZZY_MATCHING => GenerisRdf::GENERIS_TRUE,
                OntologyIndex::PROPERTY_DEFAULT_SEARCH  => GenerisRdf::GENERIS_FALSE,
            ));

        $property->setPropertyValue($this->getProperty(OntologyIndex::PROPERTY_INDEX), $indexProperty);

        //generate form
        $indexFormContainer = new tao_actions_form_IndexProperty(new OntologyIndex($indexProperty), $propertyIndex.$index);
        $myForm = $indexFormContainer->getForm();
        $form = trim(preg_replace('/\s+/', ' ', $myForm->renderElements()));
        $this->returnJson(array('form' => $form));
    }
826764
function(index) {
      var that = this;

      var props = this._propIndex(index);
      if (!props) {
        return Promise.reject(new Error('No auto-indexing key specified'));
      }

      return this._dbApi.find(props).then(function(docs) {
        return that._readDoc(docs[0]);
      });
    }
484848
public String addMapDocument(String indexName, String indexType, Map params,ClientOptions clientOptions) throws ElasticSearchException{
		Object docId = null;
		Object parentId = null;
		Object routing = null;
		String refreshOption = null;
		if(clientOptions != null) {
			refreshOption = clientOptions.getRefreshOption();
			docId = clientOptions.getIdField() != null ? params.get(clientOptions.getIdField()) : null;
			parentId = clientOptions.getParentIdField() != null ? params.get( clientOptions.getParentIdField()) : null;
			routing = clientOptions.getRountField() != null ? params.get(clientOptions.getRountField()) : null;
		}
		return addDocument(  indexName,   indexType,   params,  docId,  parentId,  routing,  refreshOption);
	}
924752
function normalize( id, baseId ) {
        if ( !id ) {
            return '';
        }

        baseId = baseId || '';
        var idInfo = parseId( id );
        if ( !idInfo ) {
            return id;
        }

        var resourceId = idInfo.resource;
        var moduleId = relative2absolute( idInfo.module, baseId );

        each(
            packagesIndex,
            function ( packageConf ) {
                var name = packageConf.name;
                if ( name === moduleId ) {
                    moduleId = name + '/' + packageConf.main;
                    return false;
                }
            }
        );

        // 根据config中的map配置进行module id mapping
        indexRetrieve(
            baseId,
            mappingIdIndex,
            function ( value ) {

                indexRetrieve(
                    moduleId,
                    value,
                    function ( mdValue, mdKey ) {
                        moduleId = moduleId.replace( mdKey, mdValue );
                    }
                );

            }
        );

        if ( resourceId ) {
            var module = modGetModuleExports( moduleId );
            resourceId = module.normalize
                ? module.normalize(
                    resourceId,
                    function ( resId ) {
                        return normalize( resId, baseId );
                    }
                  )
                : normalize( resourceId, baseId );

            moduleId += '!' + resourceId;
        }

        return moduleId;
    }
1303348
function addAll(packages, packageIndex) {
		
	// iterate over packages and prepare urls before I call the registry
	for (var p in packages) {
		if(p.indexOf('@') === 0) {
			p = p.substring(p.indexOf('/') + 1, p.length)
		}
		var package = p + '@' + packages[p]

		if (packageIndex.indexOf(package) === -1) {
			packageIndex.push(package)
		}
	}	
}
685536
function urlFromIndex(index) {
    assert.bool(index.official, 'index.official');
    assert.optionalString(index.scheme, 'index.scheme');
    assert.string(index.name, 'index.name');

    if (index.official) {  // v1
        return DEFAULT_INDEX_URL;
    } else {
        return fmt('%s://%s', index.scheme || 'https', index.name);
    }
}
11222
@NotNull
    public Map<String, Set<String>> getIndexNamesAndAliases(String indexPattern) {
        // only request indices matching the name or pattern in `indexPattern` and only get the alias names for each index,
        // not the settings or mappings
        final GetAliases request = new GetAliases.Builder()
                .addIndex(indexPattern)
                // ES 6 changed the "expand_wildcards" default value for the /_alias API from "open" to "all".
                // Since our code expects only open indices to be returned, we have to explicitly set the parameter now.
                .setParameter("expand_wildcards", "open")
                .build();

        final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Couldn't collect aliases for index pattern " + indexPattern);

        final ImmutableMap.Builder<String, Set<String>> indexAliasesBuilder = ImmutableMap.builder();
        final Iterator<Map.Entry<String, JsonNode>> it = jestResult.getJsonObject().fields();
        while (it.hasNext()) {
            final Map.Entry<String, JsonNode> entry = it.next();
            final String indexName = entry.getKey();
            final JsonNode aliasMetaData = entry.getValue().path("aliases");
            if (aliasMetaData.isObject()) {
                final ImmutableSet<String> aliasNames = ImmutableSet.copyOf(aliasMetaData.fieldNames());
                indexAliasesBuilder.put(indexName, aliasNames);
            }
        }

        return indexAliasesBuilder.build();
    }
375081
public List<IndexField> getIndexMappingFields(String index,final String indexType) throws ElasticSearchException{
		try{
			final List<IndexField> fields = new ArrayList<IndexField>();
			getIndexMapping(index,false,new ResponseHandler<Void>(){

				@Override
				public Void handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
					int status = response.getStatusLine().getStatusCode();

					if (status >= 200 && status < 300) {
						HttpEntity entity = response.getEntity();
						/**
						 * Map<indexName,Mapping<Type,Properties<fieldName<"fileds",Map<subFieldName,IndexField>>,Type>>>
						 */
						if(!client.isUpper7()) {
							Map<String, Object> map = SimpleStringUtil.json2ObjectWithType(entity.getContent(), new JsonTypeReference<Map<String, Object>>() {
							});
							Iterator<Map.Entry<String, Object>> entries = map.entrySet().iterator();
							while (entries.hasNext()) {
								Map.Entry<String, Object> entry = entries.next();//去最新的映射版本，区别于每天的索引表版本
								Map<String, Map<String, Object>> mapping = (Map<String, Map<String, Object>>) entry.getValue();
								Map<String, Map<String, Object>> typeProperties = (Map<String, Map<String, Object>>) mapping.get("mappings").get(indexType);
								Map<String, Object> properties = (Map<String, Object>) typeProperties.get("properties");
								Iterator<Map.Entry<String, Object>> fileds = properties.entrySet().iterator();
								while (fileds.hasNext()) {
									Map.Entry<String, Object> field = fileds.next();
									IndexField indexField = BuildTool.buildIndexField(field, fields, null);
								}
								break;

							}
						}
						else{
							Map<String, Object> map = SimpleStringUtil.json2ObjectWithType(entity.getContent(), new JsonTypeReference<Map<String, Object>>() {
							});
							Iterator<Map.Entry<String, Object>> entries = map.entrySet().iterator();
							while (entries.hasNext()) {
								Map.Entry<String, Object> entry = entries.next();//去最新的映射版本，区别于每天的索引表版本
								Map<String, Map<String, Object>> index = (Map<String, Map<String, Object>>) entry.getValue();
								Map<String,Object> mapping = index.get("mappings");
								Map<String, Object> properties = (Map<String, Object>) mapping.get("properties");
								Iterator<Map.Entry<String, Object>> fileds = properties.entrySet().iterator();
								while (fileds.hasNext()) {
									Map.Entry<String, Object> field = fileds.next();
									IndexField indexField = BuildTool.buildIndexField(field, fields, null);
								}
								break;

							}
						}
						/**
						 * Map<indexName,Properties<fieldName<"fileds",Map<subFieldName,IndexField>>,Type>>
						 */
						return null;

					} else {
						HttpEntity entity = response.getEntity();
						if (entity != null )
							throw new ElasticSearchException(new StringBuilder().append("Unexpected response : " ).append( EntityUtils.toString(entity)).toString(),status);
						else
							throw new ElasticSearchException("Unexpected response status: " + status,status);
					}
				}
			});
			return fields;
		}
		catch(ElasticSearchException e){
			return (List<IndexField>)ResultUtil.hand404HttpRuntimeException(e,Object.class,ResultUtil.OPERTYPE_getIndice);
		}

	}
54633
Index addExprIndex(int[] col, Expression[] indexExprs, HsqlName name, boolean unique, boolean migrating, Expression predicate) {

        Index newindex;

        if (table.isEmpty(session) || table.isIndexingMutable()) {
            newindex = table.createAndAddExprIndexStructure(name, col, indexExprs, unique, migrating, false);
        } else {
            newindex = table.createIndexStructure(name, col, null, null,
                    unique, migrating, false, false).withExpressions(indexExprs);

            Table tn = table.moveDefinition(session, table.tableType, null,
                                            null, newindex, -1, 0, emptySet,
                                            emptySet);
            // for all sessions move the data
            tn.moveData(session, table, -1, 0);
            database.persistentStoreCollection.releaseStore(table);

            table = tn;

            setNewTableInSchema(table);
            updateConstraints(table, emptySet);
        }

        database.schemaManager.addSchemaObject(newindex);
        database.schemaManager.recompileDependentObjects(table);

        if (predicate != null) {
            newindex = newindex.withPredicate(predicate);
        }

        return newindex;
    }
758231
def _CreateIndexIfNotExists(self, index_name, mappings):
    
    try:
      if not self._client.indices.exists(index_name):
        self._client.indices.create(
            body={'mappings': mappings}, index=index_name)

    except elasticsearch.exceptions.ConnectionError as exception:
      raise RuntimeError(
          'Unable to create Elasticsearch index with error: {0!s}'.format(
              exception))
1214865
protected void buildIndexMap(RootDoc root)  {
        PackageDoc[] packages = root.specifiedPackages();
        ClassDoc[] classes = root.classes();
        if (!classesOnly) {
            if (packages.length == 0) {
                Set<PackageDoc> set = new HashSet<>();
                for (ClassDoc aClass : classes) {
                    PackageDoc pd = aClass.containingPackage();
                    if (pd != null && pd.name().length() > 0) {
                        set.add(pd);
                    }
                }
                adjustIndexMap(set.toArray(packages));
            } else {
                adjustIndexMap(packages);
            }
        }
        adjustIndexMap(classes);
        if (!classesOnly) {
            for (ClassDoc aClass : classes) {
                if (shouldAddToIndexMap(aClass)) {
                    putMembersInIndexMap(aClass);
                }
            }
        }
        sortIndexMap();
    }
1175829
function indexTemplate(format, data) {
  if (format === 'cjs') {
    return `module.exports = require('${data.main}')`
  }
  if (format === 'esm') {
    return `import ${data.name} from '${data.main}'

export default ${data.name}`
  }
}