schema {{ schema_name }} {
    document {{ document_name }} {
    {% for field in fields %}
        field {{ field.name }} type {{ field.type }} {
            {% if field.indexing %}
            indexing: {{ field.indexing_to_text }}
            {% endif %}
            {% if field.index %}
            index: {{ field.index }}
            {% endif %}
        }
        {% endfor %}
    }
{% for key, value in fieldsets.items() %}
    fieldset {{ key }} {
        fields: {{ value.fields_to_text }}
    }
{% endfor %}
{% for key, value in rank_profiles.items() %}
    rank-profile {{ key }}{% if value.inherits %} inherits {{ value.inherits }}{% endif %} {
        {% if value.first_phase %}
        first-phase {
            expression: {{ value.first_phase }}
        }
        {% endif %}
    }
{% endfor %}
}