The REST API spec for cat.tasks lists support for parameters "parent_task", "actions" and "node_id"
|
"node_id":{ |
|
"type":"list", |
|
"description":"A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes" |
|
}, |
|
"actions":{ |
|
"type":"list", |
|
"description":"A comma-separated list of actions that should be returned. Leave empty to return all." |
|
}, |
|
"detailed":{ |
|
"type":"boolean", |
|
"description":"Return detailed task information (default: false)" |
|
}, |
|
"parent_task":{ |
|
"type":"number", |
|
"description":"Return tasks with specified parent task id. Set to -1 to return all." |
|
}, |
These all however return a 400 response when attempting to use:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"request [/_cat/tasks] contains unrecognized parameter: [actions]"}],"type":"illegal_argument_e
xception","reason":"request [/_cat/tasks] contains unrecognized parameter: [actions]"},"status":400}
Looking at RestTasksAction, it looks like this might be because the consumption of these params will happen inside the prepared RestChannelConsumer action
https://github.com/elastic/elasticsearch/blob/701ef94b4ddb3615ca0a8262f60de244cb52855e/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java
and thus after the unconsumed params check in BaseRestHandler's handleRequest
|
public final void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { |
|
// prepare the request for execution; has the side effect of touching the request parameters |
|
final RestChannelConsumer action = prepareRequest(request, client); |
|
|
|
// validate unconsumed params, but we must exclude params used to format the response |
|
// use a sorted set so the unconsumed parameters appear in a reliable sorted order |
|
final SortedSet<String> unconsumedParams = |
|
request.unconsumedParams().stream().filter(p -> !responseParams().contains(p)).collect(Collectors.toCollection(TreeSet::new)); |
|
|
|
// validate the non-response params |
|
if (!unconsumedParams.isEmpty()) { |
|
final Set<String> candidateParams = new HashSet<>(); |
|
candidateParams.addAll(request.consumedParams()); |
|
candidateParams.addAll(responseParams()); |
|
throw new IllegalArgumentException(unrecognized(request, unconsumedParams, candidateParams, "parameter")); |
|
} |
|
|
|
if (request.hasContent() && request.isContentConsumed() == false) { |
|
throw new IllegalArgumentException("request [" + request.method() + " " + request.path() + "] does not support having a body"); |
|
} |
|
|
|
usageCount.increment(); |
|
// execute the action |
|
action.accept(channel); |
|
} |
An aside: parent_task should probably be called parent_task_id, as this name would align with the header on the response and the list tasks API. In addition, the "type" in the REST spec should be "string" rather than "number"
The REST API spec for
cat.taskslists support for parameters "parent_task", "actions" and "node_id"elasticsearch/rest-api-spec/src/main/resources/rest-api-spec/api/cat.tasks.json
Lines 23 to 38 in 1c3b341
These all however return a 400 response when attempting to use:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"request [/_cat/tasks] contains unrecognized parameter: [actions]"}],"type":"illegal_argument_e xception","reason":"request [/_cat/tasks] contains unrecognized parameter: [actions]"},"status":400}Looking at
RestTasksAction, it looks like this might be because the consumption of these params will happen inside the preparedRestChannelConsumeractionhttps://github.com/elastic/elasticsearch/blob/701ef94b4ddb3615ca0a8262f60de244cb52855e/server/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java
and thus after the unconsumed params check in
BaseRestHandler'shandleRequestelasticsearch/server/src/main/java/org/elasticsearch/rest/BaseRestHandler.java
Lines 78 to 102 in 57bd6d2
An aside:
parent_taskshould probably be calledparent_task_id, as this name would align with the header on the response and the list tasks API. In addition, the"type"in the REST spec should be"string"rather than"number"