Search in sources :

Example 1 with SearchResponseSections

use of org.opensearch.action.search.SearchResponseSections in project OpenSearch by opensearch-project.

the class RestHighLevelClientTests method testSearchScroll.

public void testSearchScroll() throws IOException {
    SearchResponse mockSearchResponse = new SearchResponse(new SearchResponseSections(SearchHits.empty(), InternalAggregations.EMPTY, null, false, false, null, 1), randomAlphaOfLengthBetween(5, 10), 5, 5, 0, 100, ShardSearchFailure.EMPTY_ARRAY, SearchResponse.Clusters.EMPTY);
    mockResponse(mockSearchResponse);
    SearchResponse searchResponse = restHighLevelClient.scroll(new SearchScrollRequest(randomAlphaOfLengthBetween(5, 10)), RequestOptions.DEFAULT);
    assertEquals(mockSearchResponse.getScrollId(), searchResponse.getScrollId());
    assertEquals(0, searchResponse.getHits().getTotalHits().value);
    assertEquals(5, searchResponse.getTotalShards());
    assertEquals(5, searchResponse.getSuccessfulShards());
    assertEquals(100, searchResponse.getTook().getMillis());
}
Also used : SearchResponseSections(org.opensearch.action.search.SearchResponseSections) SearchScrollRequest(org.opensearch.action.search.SearchScrollRequest) SearchResponse(org.opensearch.action.search.SearchResponse)

Aggregations

SearchResponse (org.opensearch.action.search.SearchResponse)1 SearchResponseSections (org.opensearch.action.search.SearchResponseSections)1 SearchScrollRequest (org.opensearch.action.search.SearchScrollRequest)1