# Execution order of multiple indexes during \_reindex call

**URL:** <https://discuss.elastic.co/t/execution-order-of-multiple-indexes-during-reindex-call/244682>\
**Category:** Elasticsearch\
**Created:** [August 12, 2020, 8:50am UTC](https://discuss.elastic.co/t/execution-order-of-multiple-indexes-during-reindex-call/244682 "2020-08-12T08:50:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anitabee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anitabee/32/73727_2.png) [@anitabee](https://discuss.elastic.co/u/anitabee)\
**Post date:** [August 12, 2020, 8:50am UTC](https://discuss.elastic.co/t/execution-order-of-multiple-indexes-during-reindex-call/244682/1 "2020-08-12T08:50:59Z")

</div>

Hi all 👋,

During `_reindex` call, if I specify remote source from multiple indexes, In which order are those indexes going to be processed?

I saw in documentation that there was `sort` option in reindex but it is deprecated since `7.6`, and that sort was never guaranteed.

In case above was not clear enough, I'm trying to do something like this:

```auto
POST _reindex/?wait_for_completion=false&wait_for_active_shards=all
{
  "source": {
    "remote": {
      "host": "https://example.com:443"
    },
    "index": "my-index-*",
    "size": 5000,
    "query": {
      "match_all": {}
    }
  },
  "dest": {
    "index": "my-index-new"
  }
}

```

And reason why I am asking is because I have quite some duplicate document ids spread-ed over `my-index-yyyy-MM-dd` on remote, not all have desired states recorded, but the latest inserted version is the one I want to keep on my `my-index-new`, and it "seems" that documents are kinda updated in that order.

So maybe coincidence but from what I am seeing based on results, it looks like execution is done based on timestamp/insertion order of remote indexes? Or there is no guarantee for this?

`remote es version: 6.6`  
`destination es version: 7.8`

---

<div class="post-metadata">

**Author:** ![anitabee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anitabee/32/73727_2.png) [@anitabee](https://discuss.elastic.co/u/anitabee)\
**Post date:** [August 17, 2020, 12:05pm UTC](https://discuss.elastic.co/t/execution-order-of-multiple-indexes-during-reindex-call/244682/2 "2020-08-17T12:05:46Z")

</div>

Anyone has some pointers for this one?

---

<div class="post-metadata">

**Author:** ![anitabee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anitabee/32/73727_2.png) [@anitabee](https://discuss.elastic.co/u/anitabee)\
**Post date:** [August 18, 2020, 7:32pm UTC](https://discuss.elastic.co/t/execution-order-of-multiple-indexes-during-reindex-call/244682/3 "2020-08-18T19:32:13Z")

</div>

Answer: execution is **not** done based on timestamp/insertion order of remote indexes, few checks based on above assumption were coincidence

---

<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:** [September 15, 2020, 7:32pm UTC](https://discuss.elastic.co/t/execution-order-of-multiple-indexes-during-reindex-call/244682/4 "2020-09-15T19:32:16Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
