# How to find the precise "reindex" by "\_tasks" API?

**URL:** https://discuss.elastic.co/t/how-to-find-the-precise-reindex-by--tasks-api/56479
**Category:** Elasticsearch
**Created:** [July 27, 2016, 8:04am UTC](https://discuss.elastic.co/t/how-to-find-the-precise-reindex-by--tasks-api/56479 "2016-07-27T08:04:35Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![1222kkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/1222kkk/32/23635_2.png) [@1222kkk](https://discuss.elastic.co/u/1222kkk)
#### Post date: [July 27, 2016, 8:04am UTC](https://discuss.elastic.co/t/how-to-find-the-precise-reindex-by--tasks-api/56479/1 "2016-07-27T08:04:35Z")

</div>

many reindex operations may happened at the same time

but the " /\_tasks/ " can not distinguish them

may like this  
"tasks": {  
"N6P1aVclSEibQbEgKSoM4Q:580812": {  
"node": "N6P1aVclSEibQbEgKSoM4Q",  
"id": 580812,  
"type": "transport",  
"action": "indices:data/write/reindex",  
"status": {  
"total": 303600,  
"updated": 300,  
"created": 0,  
"deleted": 0,  
"batches": 4,  
"version\_conflicts": 0,  
"noops": 0,  
"retries": 0  
},  
"description": "",  
"start\_time\_in\_millis": 1469606609258,  
"running\_time\_in\_nanos": 2053612568  
},  
"N6P1aVclSEibQbEgKSoM4Q:577835": {  
"node": "N6P1aVclSEibQbEgKSoM4Q",  
"id": 577835,  
"type": "transport",  
"action": "indices:data/write/reindex",  
"status": {  
"total": 303600,  
"updated": 12000,  
"created": 0,  
"deleted": 0,  
"batches": 121,  
"version\_conflicts": 0,  
"noops": 0,  
"retries": 0  
},  
"description": "",  
"start\_time\_in\_millis": 1469606501541,  
"running\_time\_in\_nanos": 109770467817  
}  
}

how can I know what is the reindex doing ?the soure and the dest ?

---

<div class="post-metadata">

### Author: ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)
#### Post date: [July 27, 2016, 8:35am UTC](https://discuss.elastic.co/t/how-to-find-the-precise-reindex-by--tasks-api/56479/2 "2016-07-27T08:35:18Z")

</div>

Hi @1222kkk,

as far as I am aware of you cannot find out with the task API which reindexing operation is doing what.

May I ask what's your use case to run a lot of reindex tasks concurrently?

Daniel

---

<div class="post-metadata">

### Author: ![1222kkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/1222kkk/32/23635_2.png) [@1222kkk](https://discuss.elastic.co/u/1222kkk)
#### Post date: [July 27, 2016, 8:43am UTC](https://discuss.elastic.co/t/how-to-find-the-precise-reindex-by--tasks-api/56479/3 "2016-07-27T08:43:05Z")

</div>

> [@danielmitterdorfer](#):
>
> May I ask what's your use case to run a lot of reindex

maybe many old index should be reindex to new ones at the same time ,and I want to monitor the states ,.  
so I have to distinguish them from the result of the /\_tasks?action=\*reindex ,because the result may contain many actions named "indices:data/write/reindex" .so how can i know this reindex action is from "index1"to "index2",and this reindex action represents reindex from "index 3"to "index 4".  
my english is really clumsy ,but can you understand it？

---

<div class="post-metadata">

### Author: ![1222kkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/1222kkk/32/23635_2.png) [@1222kkk](https://discuss.elastic.co/u/1222kkk)
#### Post date: [July 27, 2016, 8:49am UTC](https://discuss.elastic.co/t/how-to-find-the-precise-reindex-by--tasks-api/56479/4 "2016-07-27T08:49:17Z")

</div>

if i want to monitor the status of the reindex , but I can not distinguish them from the resluts of the "/\_task?action=\*reindex" ,so the only way is to run only one "reindex" operation at the same time?

---

<div class="post-metadata">

### Author: ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)
#### Post date: [July 27, 2016, 9:31am UTC](https://discuss.elastic.co/t/how-to-find-the-precise-reindex-by--tasks-api/56479/5 "2016-07-27T09:31:51Z")

</div>

Hi,

> so I have to distinguish them from the result of the  
> /\_tasks?action=\*reindex ,because the result may contain many actions  
> named "indices:data/write/reindex" .so how can i know this reindex  
> action is from "index1"to "index2"

In the reindex API you can have multiple source indices but only one destination index so you really need to run multiple reindex tasks.

> if i want to monitor the status of the reindex , but I can not  
> distinguish them from the resluts of the "/\_task?action=\*reindex" ,so  
> the only way is to run only one "reindex" operation at the same time?

You can do either that or have some client side logic to figure out the task id right after you have submitted a new reindex task. I will ask the colleague that wrote the reindex API later to check whether there is a better way to do that.

Daniel

---

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [July 27, 2016, 12:31pm UTC](https://discuss.elastic.co/t/how-to-find-the-precise-reindex-by--tasks-api/56479/6 "2016-07-27T12:31:00Z")

</div>

> [@danielmitterdorfer](#):
>
> In the reindex API you can have multiple source indices but only one destination index so you really need to run multiple reindex tasks.

I mean, you _can_ work around this with scripting, especially in the 5.0-alphas because painless is always there and nice. But It probably isn't a good choice because the process isn't really resume-able. Breaking it into chunks helps with that and indexes are natural chunks. The same is true for doing it in parallel.

> [@danielmitterdorfer](#):
>
> You can do either that or have some client side logic to figure out the task id right after you have submitted a new reindex task.

That'd be running the reindex with `?wait_for_completion=false` and capturing the task id. The issue with doing that in the 2.x line is that we don't have task result persistence so once the reindex actually completes it just vanishes. In that latest 5.0-alpha this is fixed by persisting the result to an index.

In 2.x you _can_ use start time/running time to figure out which reindex is which. I admit that isn't great. I'd like to improve the tasks API to return the request that you sent it so you can tell them apart.

---

<div class="post-metadata">

### Author: ![1222kkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/1222kkk/32/23635_2.png) [@1222kkk](https://discuss.elastic.co/u/1222kkk)
#### Post date: [July 27, 2016, 12:57pm UTC](https://discuss.elastic.co/t/how-to-find-the-precise-reindex-by--tasks-api/56479/7 "2016-07-27T12:57:35Z")

</div>

Thank you for your reply. It really inspires me a lot .And now I try to distinguish them by taskID(may be a solution?).  
I really hope the improvement will come soon . Thanks for your contribution!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 10:32pm UTC](https://discuss.elastic.co/t/how-to-find-the-precise-reindex-by--tasks-api/56479/8 "2017-07-05T22:32:34Z")

</div>


