Skip to content

Commit 0cedb9a

Browse files
committed
CR fixes
1 parent 789362f commit 0cedb9a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/EsqlListQueriesResponse.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import org.elasticsearch.action.ActionResponse;
1111
import org.elasticsearch.common.io.stream.StreamOutput;
12+
import org.elasticsearch.tasks.TaskId;
1213
import org.elasticsearch.xcontent.ToXContentFragment;
1314
import org.elasticsearch.xcontent.ToXContentObject;
1415
import org.elasticsearch.xcontent.XContentBuilder;
@@ -19,9 +20,7 @@
1920
public class EsqlListQueriesResponse extends ActionResponse implements ToXContentObject {
2021
private final List<Query> queries;
2122

22-
public record Query(org.elasticsearch.tasks.TaskId taskId, long startTimeMillis, long runningTimeNanos, String query)
23-
implements
24-
ToXContentFragment {
23+
public record Query(TaskId taskId, long startTimeMillis, long runningTimeNanos, String query) implements ToXContentFragment {
2524
@Override
2625
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
2726
builder.startObject(taskId.toString());

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/TransportEsqlGetQueryAction.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.elasticsearch.xpack.core.ClientHelper;
2727
import org.elasticsearch.xpack.esql.action.EsqlGetQueryAction;
2828
import org.elasticsearch.xpack.esql.action.EsqlGetQueryRequest;
29+
import org.elasticsearch.xpack.esql.action.EsqlQueryAction;
2930

3031
import static org.elasticsearch.xpack.core.ClientHelper.ESQL_ORIGIN;
3132

@@ -49,6 +50,10 @@ protected void doExecute(Task task, EsqlGetQueryRequest request, ActionListener<
4950
@Override
5051
public void onResponse(GetTaskResponse response) {
5152
TaskInfo task = response.getTask().getTask();
53+
if (task.action().startsWith(EsqlQueryAction.NAME) == false) {
54+
listener.onFailure(new IllegalArgumentException("Task [" + request.id() + "] is not an ESQL query task"));
55+
return;
56+
}
5257
ClientHelper.executeAsyncWithOrigin(
5358
nodeClient,
5459
ESQL_ORIGIN,

0 commit comments

Comments
 (0)