public SchemaDef addAlias(String alias, String aliased) {
        noShadowing(alias);
        if (!fields.containsKey(aliased) && !indexNames.contains(aliased)) {
            if (aliased.contains(".")) {
                // TODO Here we should nest ourself down to something that really exists.
                log.warning("Aliased item '" + aliased + "' not verifiable. Allowing it to be aliased to '" +
                            alias + " for now. Validation will come when URL/Position is structified.");
            } else {
                throw new IllegalArgumentException("Schema '" + getName() + "' has nothing named '" +
                                                   aliased + "'to alias to '" + alias + "'.");
            }
        }
        String oldAliased = aliases.get(alias);
        if ((oldAliased != null)) {
            if (oldAliased.equals(aliased)) {
                throw new IllegalArgumentException("Schema '" + getName() + "' already has the alias '" + alias +
                                                   "' to '" + aliased + ". Why do you want to add it again.");

            } else {
                throw new IllegalArgumentException("Schema '" + getName() + "' already has the alias '" + alias +
                                                   "' to '" + oldAliased + ". Cannot change it to alias '" + aliased + "'.");
            }
        } else {
            aliases.put(alias, aliased);
        }
        return this;
    }
Adds a search field to the schema.

@param field the field to add
@return this, for chaining
config-model/src/main/java/com/yahoo/vespa/documentmodel/SchemaDef.java