use of org.graylog2.indexer.searches.ScrollCommand.NO_BATCHSIZE in project graylog2-server by Graylog2.
the class SearchesIT method scrollReturnsResultWithSelectiveFields.
@Test
public void scrollReturnsResultWithSelectiveFields() throws Exception {
importFixture("org/graylog2/indexer/searches/SearchesIT.json");
when(indexSetRegistry.getForIndices(Collections.singleton("graylog_0"))).thenReturn(Collections.singleton(indexSet));
final AbsoluteRange range = AbsoluteRange.create(new DateTime(2015, 1, 1, 0, 0, DateTimeZone.UTC).withZone(UTC), new DateTime(2015, 1, 2, 0, 0, DateTimeZone.UTC).withZone(UTC));
final ScrollResult scrollResult = searches.scroll("*", range, 5, 0, Collections.singletonList("source"), null, NO_BATCHSIZE);
assertThat(scrollResult).isNotNull();
assertThat(scrollResult.getQueryHash()).isNotEmpty();
assertThat(scrollResult.totalHits()).isEqualTo(10L);
final ScrollResult.ScrollChunk firstChunk = scrollResult.nextChunk();
assertThat(firstChunk).isNotNull();
assertThat(firstChunk.getMessages()).hasSize(5);
assertThat(firstChunk.isFirstChunk()).isTrue();
assertThat(firstChunk.getFields()).containsExactly("source");
}
Aggregations