private void innerFinishHim() { InternalSearchResponse internalResponse = searchPhaseController.merge(sortedShardList, queryResults, fetchResults); String scrollId = null; if (request.scroll() != null) { scrollId = request.scrollId(); } listener.onResponse( new SearchResponse( internalResponse, scrollId, this.scrollId.getContext().length, successfulOps.get(), System.currentTimeMillis() - startTime, buildShardFailures())); }
@Test public void testParseSearchScrollRequest() throws Exception { BytesReference content = XContentFactory.jsonBuilder() .startObject() .field("scroll_id", "SCROLL_ID") .field("scroll", "1m") .endObject() .bytes(); SearchScrollRequest searchScrollRequest = new SearchScrollRequest(); RestSearchScrollAction.buildFromContent(content, searchScrollRequest); assertThat(searchScrollRequest.scrollId(), equalTo("SCROLL_ID")); assertThat( searchScrollRequest.scroll().keepAlive(), equalTo(TimeValue.parseTimeValue("1m", null, "scroll"))); }