private List<QueryField> buildFields(final StatisticStoreDoc entity) {
        List<QueryField> fields = new ArrayList<>();

        // TODO currently only BETWEEN is supported, but need to add support for
        // more conditions like >, >=, <, <=, =
        fields.add(QueryField
                .builder()
                .fldName(StatisticStoreDoc.FIELD_NAME_DATE_TIME)
                .fldType(FieldType.DATE)
                .conditionSet(ConditionSet.STAT_DATE)
                .queryable(true)
                .build());

        // one field per tag
        if (entity.getConfig() != null) {
            for (final StatisticField statisticField : entity.getStatisticFields()) {
                // TODO currently only EQUALS is supported, but need to add
                // support for more conditions like CONTAINS
                fields.add(QueryField
                        .builder()
                        .fldName(statisticField.getFieldName())
                        .fldType(FieldType.TEXT)
                        .conditionSet(ConditionSet.STAT_TEXT)
                        .queryable(true)
                        .build());
            }
        }

        fields.add(QueryField.createLong(StatisticStoreDoc.FIELD_NAME_COUNT, false));

        if (entity.getStatisticType().equals(StatisticType.VALUE)) {
            fields.add(QueryField.createLong(StatisticStoreDoc.FIELD_NAME_VALUE, false));
        }

        fields.add(QueryField.createLong(StatisticStoreDoc.FIELD_NAME_PRECISION_MS, false));

        // Filter fields.
        if (entity.getConfig() != null) {
            fields = statistics.getSupportedFields(fields);
        }

        return fields;
    }
Turn the {@link StatisticStoreDoc} into an {@link List<QueryField>} object
<p>
This builds the standard set of fields for a statistics store, which can
be filtered by the relevant statistics store instance
stroom-statistics/stroom-statistics-impl-sql/src/main/java/stroom/statistics/impl/sql/search/SqlStatisticSearchProvider.java