Skip to content

Commit dc4dc94

Browse files
committed
Fix "resource not found" exception on existing EQL async search (#65167)
This change fixes the initialization of the async results service for the EQL get async action. The boolean that differentiates EQL from normal _async_search request is set incorrectly, which results in errors (404) when extending the keep alive of a running EQL search. Fixes #65108
1 parent a607577 commit dc4dc94

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

x-pack/plugin/eql/src/internalClusterTest/java/org/elasticsearch/xpack/eql/action/AsyncEqlSearchActionIT.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public void testBasicAsyncExecution() throws Exception {
121121
if (randomBoolean()) {
122122
// let's timeout first
123123
GetAsyncResultRequest getResultsRequest = new GetAsyncResultRequest(response.id())
124+
.setKeepAlive(TimeValue.timeValueMinutes(10))
124125
.setWaitForCompletionTimeout(TimeValue.timeValueMillis(10));
125126
EqlSearchResponse responseWithTimeout = client().execute(EqlAsyncGetResultAction.INSTANCE, getResultsRequest).get();
126127
assertThat(responseWithTimeout.isRunning(), is(true));
@@ -130,6 +131,7 @@ public void testBasicAsyncExecution() throws Exception {
130131

131132
// Now we wait
132133
GetAsyncResultRequest getResultsRequest = new GetAsyncResultRequest(response.id())
134+
.setKeepAlive(TimeValue.timeValueMinutes(10))
133135
.setWaitForCompletionTimeout(TimeValue.timeValueSeconds(10));
134136
ActionFuture<EqlSearchResponse> future = client().execute(EqlAsyncGetResultAction.INSTANCE, getResultsRequest);
135137
disableBlocks(plugins);
@@ -141,7 +143,6 @@ public void testBasicAsyncExecution() throws Exception {
141143
Exception ex = expectThrows(Exception.class, future::actionGet);
142144
assertThat(ex.getCause().getMessage(), containsString("by zero"));
143145
}
144-
145146
AcknowledgedResponse deleteResponse =
146147
client().execute(DeleteAsyncResultAction.INSTANCE, new DeleteAsyncResultRequest(response.id())).actionGet();
147148
assertThat(deleteResponse.isAcknowledged(), equalTo(true));

x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/TransportEqlAsyncGetResultAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static AsyncResultsService<EqlSearchTask, StoredAsyncResponse<EqlSearchResponse>
5656
Writeable.Reader<StoredAsyncResponse<EqlSearchResponse>> reader = in -> new StoredAsyncResponse<>(EqlSearchResponse::new, in);
5757
AsyncTaskIndexService<StoredAsyncResponse<EqlSearchResponse>> store = new AsyncTaskIndexService<>(XPackPlugin.ASYNC_RESULTS_INDEX,
5858
clusterService, threadPool.getThreadContext(), client, ASYNC_SEARCH_ORIGIN, reader, registry);
59-
return new AsyncResultsService<>(store, true, EqlSearchTask.class,
59+
return new AsyncResultsService<>(store, false, EqlSearchTask.class,
6060
(task, listener, timeout) -> AsyncTaskManagementService.addCompletionListener(threadPool, task, listener, timeout),
6161
transportService.getTaskManager(), clusterService);
6262
}

0 commit comments

Comments
 (0)