use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.search.ClearScrollRequest in project elasticsearch by elastic.
the class RestClearScrollAction method prepareRequest.
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
String scrollIds = request.param("scroll_id");
ClearScrollRequest clearRequest = new ClearScrollRequest();
clearRequest.setScrollIds(Arrays.asList(splitScrollIds(scrollIds)));
request.withContentOrSourceParamParserOrNull((xContentParser -> {
if (xContentParser != null) {
clearRequest.setScrollIds(null);
try {
buildFromContent(xContentParser, clearRequest);
} catch (IOException e) {
throw new IllegalArgumentException("Failed to parse request body", e);
}
}
}));
return channel -> client.clearScroll(clearRequest, new RestStatusToXContentListener<>(channel));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.search.ClearScrollRequest in project elasticsearch by elastic.
the class ParentTaskAssigningClientTests method testSetsParentId.
public void testSetsParentId() {
TaskId[] parentTaskId = new TaskId[] { new TaskId(randomAsciiOfLength(3), randomLong()) };
// This mock will do nothing but verify that parentTaskId is set on all requests sent to it.
NoOpClient mock = new NoOpClient(getTestName()) {
@Override
protected <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
assertEquals(parentTaskId[0], request.getParentTask());
super.doExecute(action, request, listener);
}
};
try (ParentTaskAssigningClient client = new ParentTaskAssigningClient(mock, parentTaskId[0])) {
// All of these should have the parentTaskId set
client.bulk(new BulkRequest());
client.search(new SearchRequest());
client.clearScroll(new ClearScrollRequest());
// Now lets verify that unwrapped calls don't have the parentTaskId set
parentTaskId[0] = TaskId.EMPTY_TASK_ID;
client.unwrap().bulk(new BulkRequest());
client.unwrap().search(new SearchRequest());
client.unwrap().clearScroll(new ClearScrollRequest());
}
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.search.ClearScrollRequest in project elasticsearch by elastic.
the class RestClearScrollActionTests method testParseClearScrollRequest.
public void testParseClearScrollRequest() throws Exception {
XContentParser content = createParser(XContentFactory.jsonBuilder().startObject().array("scroll_id", "value_1", "value_2").endObject());
ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
RestClearScrollAction.buildFromContent(content, clearScrollRequest);
assertThat(clearScrollRequest.scrollIds(), contains("value_1", "value_2"));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.search.ClearScrollRequest in project presto by prestodb.
the class ElasticsearchClient method clearScroll.
public void clearScroll(String scrollId) {
ClearScrollRequest request = new ClearScrollRequest();
request.addScrollId(scrollId);
try {
client.clearScroll(request);
} catch (IOException e) {
throw new PrestoException(ELASTICSEARCH_CONNECTION_ERROR, e);
}
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.search.ClearScrollRequest in project graylog2-server by Graylog2.
the class ScrollResultES7 method cancel.
@Override
public void cancel() throws IOException {
final ClearScrollRequest request = new ClearScrollRequest();
request.addScrollId(scrollId);
client.executeWithIOException((c, requestOptions) -> c.clearScroll(request, requestOptions), "Unable to cancel scrolling search request");
}
Aggregations