throws Exception
{
URI location = client.execute(preparePost().setUri(uriFor("/v1/query")).setBodyGenerator(createStaticBodyGenerator("query", UTF_8)).build(), new CreatedResponseHandler());
assertQueryStatus(location, QueryState.RUNNING);
QueryInfo queryInfo = client.execute(prepareGet().setUri(location).build(), createJsonResponseHandler(jsonCodec(QueryInfo.class)));
TaskInfo taskInfo = queryInfo.getOutputStage().getTasks().get(0);
URI outputLocation = uriFor("/v1/task/" + taskInfo.getTaskId() + "/results/out");
long sequenceId = 0;
PagesResponse response = client.execute(
prepareGet().setUri(uriBuilderFrom(outputLocation).appendPath(String.valueOf(sequenceId)).build()).build(),