code: @SuppressWarnings("rawtypes")
    public Object execute(final Map<Object, Object> iArgs) {
      if (indexName == null)
        throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
  
      final ODatabaseRecord database = getDatabase();
      final OIndex<?> idx;
      if (fields == null || fields.length == 0) {
        if (keyTypes != null)
          idx = database.getMetadata().getIndexManager()
              .createIndex(indexName, indexType.toString(), new OSimpleKeyIndexDefinition(keyTypes), null, null);
        else if (serializerKeyId != 0) {
          idx = database.getMetadata().getIndexManager()
              .createIndex(indexName, indexType.toString(), new ORuntimeKeyIndexDefinition(serializerKeyId), null, null);
        } else
          idx = database.getMetadata().getIndexManager().createIndex(indexName, indexType.toString(), null, null, null);
      } else {
        if (keyTypes == null || keyTypes.length == 0) {
          idx = oClass.createIndex(indexName, indexType, fields);
        } else {
          final OIndexDefinition idxDef = OIndexDefinitionFactory.createIndexDefinition(oClass, Arrays.asList(fields),
              Arrays.asList(keyTypes));
  
          idx = database.getMetadata().getIndexManager()
              .createIndex(indexName, indexType.name(), idxDef, oClass.getPolymorphicClusterIds(), null);
        }
      }
  
      if (idx != null)
        return idx.getSize();
  
      return null;
    }
docs: Execute the CREATE INDEX.