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:
{
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)
GET _tasks/n2ylnCMIQZilIterfsd1aQ:24183854
Task status response with null
{
"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
{
"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 ?