core/src/main/java/com/orientechnologies/orient/core/index/OIndexes.java
public static OIndexInternal<?> createIndex(OStorage storage, String name, String indexType, String algorithm,
      String valueContainerAlgorithm, ODocument metadata, int version) throws OConfigurationException, OIndexException {
    if (indexType.equalsIgnoreCase(OClass.INDEX_TYPE.UNIQUE_HASH_INDEX.name()) || indexType
        .equalsIgnoreCase(OClass.INDEX_TYPE.NOTUNIQUE_HASH_INDEX.name()) || indexType
        .equalsIgnoreCase(OClass.INDEX_TYPE.DICTIONARY_HASH_INDEX.name())) {
      if (!algorithm.equalsIgnoreCase("autosharding")) {
        algorithm = OHashIndexFactory.HASH_INDEX_ALGORITHM;
      }
    }

    return findFactoryByAlgorithmAndType(algorithm, indexType)
        .createIndex(name, storage, indexType, algorithm, valueContainerAlgorithm, metadata, version);

  }
public static OIndexInternal<?> createIndex(OStorage storage, String name, String indexType, String algorithm,
      String valueContainerAlgorithm, ODocument metadata, int version) throws OConfigurationException, OIndexException {
    if (indexType.equalsIgnoreCase(OClass.INDEX_TYPE.UNIQUE_HASH_INDEX.name()) || indexType
        .equalsIgnoreCase(OClass.INDEX_TYPE.NOTUNIQUE_HASH_INDEX.name()) || indexType
        .equalsIgnoreCase(OClass.INDEX_TYPE.DICTIONARY_HASH_INDEX.name())) {
      if (!algorithm.equalsIgnoreCase("autosharding")) {
        algorithm = OHashIndexFactory.HASH_INDEX_ALGORITHM;
      }
    }

    return findFactoryByAlgorithmAndType(algorithm, indexType)
        .createIndex(name, storage, indexType, algorithm, valueContainerAlgorithm, metadata, version);

  }
@param storage   TODO
@param indexType index type

@return OIndexInternal

@throws OConfigurationException if index creation failed
@throws OIndexException         if index type does not exist