# Creating a task with ‘slices’ gives a null result on GET \_tasks/\<taskid\>

**URL:** <https://discuss.elastic.co/t/creating-a-task-with-slices-gives-a-null-result-on-get-tasks-taskid/368370>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [October 7, 2024, 6:46pm UTC](https://discuss.elastic.co/t/creating-a-task-with-slices-gives-a-null-result-on-get-tasks-taskid/368370 "2024-10-07T18:46:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien\_Moulin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julien_moulin/32/138155_2.png) [@Julien\_Moulin](https://discuss.elastic.co/u/Julien_Moulin)\
**Post date:** [October 7, 2024, 6:46pm UTC](https://discuss.elastic.co/t/creating-a-task-with-slices-gives-a-null-result-on-get-tasks-taskid/368370/1 "2024-10-07T18:46:53Z")

</div>

Hi,

Context:  
I'm using Elasticsearch 7.17 with the Node.js package `@elastic/elasticsearch`.  
I have created a ‘migration’ package to automate the update of ILM, SLM, etc.  
For a migration, I need to re-index the old indexes to a data stream.

Problem:  
When I have created a reindex task with multiple slices, when I want to check if the task is complete, I get an array of slices with null values until the task is complete (false). Once the task has been completed, I have access to the slice details in the response

Creation Reindex task:

```auto
{
          wait_for_completion: false,
          slices: 4,
          body: {
            source: {index},
            dest: {
              index: "myDataStream",
              op_type: 'create', // must be set to create for data streams
            },
            script: {
              lang: 'painless',
              source: `
                [...]
              `,
            },
          },
        }

```

Query to get task status (via Kibana dev tools)

```auto
GET _tasks/n2ylnCMIQZilIterfsd1aQ:24183854

```

Task status response with null

```auto
{
  "completed" : false,
  "task" : {
    "node" : "n2ylnCMIQZilIterfsd1aQ",
    "id" : 24186200,
    "type" : "transport",
    "action" : "indices:data/write/reindex",
    "status" : {
      "total" : 0,
      "updated" : 0,
      "created" : 0,
      "deleted" : 0,
      "batches" : 0,
      "version_conflicts" : 0,
      "noops" : 0,
      "retries" : {
        "bulk" : 0,
        "search" : 0
      },
      "throttled_millis" : 0,
      "requests_per_second" : 0.0,
      "throttled_until_millis" : 0,
      "slices" : [
        null,
        null,
        null,
        null
      ]
    },
    "description" : """reindex from [data-items-2024-06] updated with Script{type=inline, lang='painless', idOrCode='
[...]
              ', options={}, params={}} to [data-items][_doc]""",
    "start_time_in_millis" : 1728325305218,
    "running_time_in_nanos" : 1344242173286,
    "cancellable" : true,
    "cancelled" : false,
    "headers" : { }
  }
}

```

Once task completed, response is OK

```auto
{
  "completed" : true,
  "task" : {
    "node" : "n2ylnCMIQZilIterfsd1aQ",
    "id" : 24186200,
    "type" : "transport",
    "action" : "indices:data/write/reindex",
    "status" : {
      "total" : 63062862,
      "updated" : 0,
      "created" : 63062862,
      "deleted" : 0,
      "batches" : 63065,
      "version_conflicts" : 0,
      "noops" : 0,
      "retries" : {
        "bulk" : 0,
        "search" : 0
      },
      "throttled_millis" : 0,
      "requests_per_second" : -1.0,
      "throttled_until_millis" : 0,
      "slices" : [
        {
          "slice_id" : 0,
          "total" : 15762551,
          "updated" : 0,
          "created" : 15762551,
          "deleted" : 0,
          "batches" : 15763,
          "version_conflicts" : 0,
          "noops" : 0,
          "retries" : {
            "bulk" : 0,
            "search" : 0
          },
          "throttled_millis" : 0,
          "requests_per_second" : -1.0,
          "throttled_until_millis" : 0
        },
        {
          "slice_id" : 1,
          "total" : 15767778,
          "updated" : 0,
          "created" : 15767778,
          "deleted" : 0,
          "batches" : 15768,
          "version_conflicts" : 0,
          "noops" : 0,
          "retries" : {
            "bulk" : 0,
            "search" : 0
          },
          "throttled_millis" : 0,
          "requests_per_second" : -1.0,
          "throttled_until_millis" : 0
        },
        {
          "slice_id" : 2,
          "total" : 15765326,
          "updated" : 0,
          "created" : 15765326,
          "deleted" : 0,
          "batches" : 15766,
          "version_conflicts" : 0,
          "noops" : 0,
          "retries" : {
            "bulk" : 0,
            "search" : 0
          },
          "throttled_millis" : 0,
          "requests_per_second" : -1.0,
          "throttled_until_millis" : 0
        },
        {
          "slice_id" : 3,
          "total" : 15767207,
          "updated" : 0,
          "created" : 15767207,
          "deleted" : 0,
          "batches" : 15768,
          "version_conflicts" : 0,
          "noops" : 0,
          "retries" : {
            "bulk" : 0,
            "search" : 0
          },
          "throttled_millis" : 0,
          "requests_per_second" : -1.0,
          "throttled_until_millis" : 0
        }
      ]
    },
[...]

```

Am I doing something wrong ?
