Skip to content

response.getTasks() incorrectly parses _tasks/_cancel response #45414

@n0othing

Description

@n0othing

Elasticsearch version (bin/elasticsearch --version): 6.8.1

Plugins installed: []

JVM version (java -version):

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

OS version (uname -a if on a Unix-like system):

Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_6

Description of the problem including expected versus actual behavior:

Our example docs [1] show how to use the response from a _tasks/_cancel API call via the HLRC. However, the parser [2] is looking for a top level tasks object, but it's really nested under nodes.* in the actual response:

{
  "nodes" : {
    "xRYjtvivTlKXuXDUL0Hhcw" : {
      "name" : "instance-0000000004",
      "transport_address" : "172.25.162.9:19987",
      "host" : "172.25.162.9",
      "ip" : "172.25.162.9:19987",
      "roles" : [
        "master",
        "data",
        "ingest"
      ],
      "attributes" : {
        "logical_availability_zone" : "zone-0",
        "server_name" : "instance-0000000004.2ab4c8015d104467862e200444aeb2ac",
        "availability_zone" : "us-east-1e",
        "xpack.installed" : "true",
        "region" : "us-east-1",
        "instance_configuration" : "aws.data.highio.i3"
      },
      "tasks" : {
        "xRYjtvivTlKXuXDUL0Hhcw:1481971" : {
          "node" : "xRYjtvivTlKXuXDUL0Hhcw",
          "id" : 1481971,
          "type" : "transport",
          "action" : "indices:data/write/reindex",
          "start_time_in_millis" : 1565108484002,
          "running_time_in_nanos" : 18328639067,
          "cancellable" : true,
          "headers" : { }
        }
      }
    }
  }
}

[1] https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.8/java-rest-high-cluster-cancel-tasks.html#_cancel_tasks_response
[2] https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/action/admin/cluster/node/tasks/list/ListTasksResponse.java#L96-L99

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions