public ExportMessagesCommand buildWithSearchOnly(Search search, ResultFormat resultFormat) {
        Query query = queryFrom(search);

        return builderFrom(resultFormat)
                .timeRange(resultFormat.timerange().orElse(toAbsolute(query.timerange())))
                .queryString(queryStringFrom(search, query))
                .usedSearchFilters(search.queries().stream()
                        .map(Query::filters)
                        .flatMap(List::stream)
                        .collect(Collectors.toList())
                )
                .streams(query.usedStreamIds())
                .build();
    }
@Test
    void searchWithMultipleQueriesLeadsToExceptionIfNoSearchTypeProvided() {
        Search s = searchWithQueries(org.graylog.plugins.views.search.TestData.validQueryBuilder().build(), org.graylog.plugins.views.search.TestData.validQueryBuilder().build());

        assertThatExceptionOfType(ExportException.class)
                .isThrownBy(() -> sut.buildWithSearchOnly(s, ResultFormat.builder().build()))
                .withMessageContaining("multiple queries");
    }