# Reindex and aliases (keep routing policy)

**URL:** <https://discuss.elastic.co/t/reindex-and-aliases-keep-routing-policy/86129>\
**Category:** Elasticsearch\
**Created:** [May 17, 2017, 2:56pm UTC](https://discuss.elastic.co/t/reindex-and-aliases-keep-routing-policy/86129 "2017-05-17T14:56:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![living\_jordi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/living_jordi/32/61363_2.png) [@living\_jordi](https://discuss.elastic.co/u/living_jordi)\
**Post date:** [May 17, 2017, 2:56pm UTC](https://discuss.elastic.co/t/reindex-and-aliases-keep-routing-policy/86129/1 "2017-05-17T14:56:36Z")

</div>

I'm using alias per user. For each alias I'm linking a `routing` and a `filter`:

```
PUT _/<index>/_alias/u1@u1.com'
{
  "routing": "u1@u1.com",
  "filter": {
    "term": {
      "user": "u1@u1.com"
    }
  }
}

```

So, I'm setting that indexation and searching is using `routing` information.

I want to reindex all documents on another index using `_reindex` api. After having created the new index, I've created all aliases. So, I figure out that documents have to be reindexed using aliases in order to keep routing policy.

Is there any way to set it up on `_reindex`?

Example:

```
POST _/_reindex
{
  "source": {
    "index": "old"
  },
  "dest": {
    "index": "new"
  }
}
'

```

Any ideas?

---

<div class="post-metadata">

**Author:** ![lwintergerst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lwintergerst/32/18164_2.png) [@lwintergerst](https://discuss.elastic.co/u/lwintergerst)\
**Post date:** [May 18, 2017, 8:58pm UTC](https://discuss.elastic.co/t/reindex-and-aliases-keep-routing-policy/86129/2 "2017-05-18T20:58:08Z")

</div>

Hi,  
\_reindex will preserve your routing values.  
If you would like to change them you can either use what \_reindex provides (take a look here [https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)) or you can use the \_ingest functionality ([https://www.elastic.co/guide/en/elasticsearch/reference/5.4/ingest.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/ingest.html))

---

<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:** [June 15, 2017, 8:58pm UTC](https://discuss.elastic.co/t/reindex-and-aliases-keep-routing-policy/86129/3 "2017-06-15T20:58:14Z")

</div>

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